| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_COMMON_LOGGING_CHROME_H__ | 5 #ifndef CHROME_COMMON_LOGGING_CHROME_H__ |
| 6 #define CHROME_COMMON_LOGGING_CHROME_H__ | 6 #define CHROME_COMMON_LOGGING_CHROME_H__ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 | 12 |
| 13 class CommandLine; | 13 class CommandLine; |
| 14 class FilePath; |
| 14 | 15 |
| 15 namespace logging { | 16 namespace logging { |
| 16 | 17 |
| 17 // Call to initialize logging for Chrome. This sets up the chrome-specific | 18 // Call to initialize logging for Chrome. This sets up the chrome-specific |
| 18 // logfile naming scheme and might do other things like log modules and | 19 // logfile naming scheme and might do other things like log modules and |
| 19 // setting levels in the future. | 20 // setting levels in the future. |
| 20 // | 21 // |
| 21 // The main process might want to delete any old log files on startup by | 22 // The main process might want to delete any old log files on startup by |
| 22 // setting delete_old_log_file, but the renderer processes should not, or | 23 // setting delete_old_log_file, but the renderer processes should not, or |
| 23 // they will delete each others' logs. | 24 // they will delete each others' logs. |
| 24 // | 25 // |
| 25 // XXX | 26 // XXX |
| 26 // Setting suppress_error_dialogs to true disables any dialogs that would | 27 // Setting suppress_error_dialogs to true disables any dialogs that would |
| 27 // normally appear for assertions and crashes, and makes any catchable | 28 // normally appear for assertions and crashes, and makes any catchable |
| 28 // errors (namely assertions) available via GetSilencedErrorCount() | 29 // errors (namely assertions) available via GetSilencedErrorCount() |
| 29 // and GetSilencedError(). | 30 // and GetSilencedError(). |
| 30 void InitChromeLogging(const CommandLine& command_line, | 31 void InitChromeLogging(const CommandLine& command_line, |
| 31 OldFileDeletionState delete_old_log_file); | 32 OldFileDeletionState delete_old_log_file); |
| 32 | 33 |
| 33 // Call when done using logging for Chrome. | 34 // Call when done using logging for Chrome. |
| 34 void CleanupChromeLogging(); | 35 void CleanupChromeLogging(); |
| 35 | 36 |
| 36 // Returns the fully-qualified name of the log file. | 37 // Returns the fully-qualified name of the log file. |
| 37 std::wstring GetLogFileName(); | 38 FilePath GetLogFileName(); |
| 38 | 39 |
| 39 // Returns true when error/assertion dialogs are to be shown, | 40 // Returns true when error/assertion dialogs are to be shown, |
| 40 // false otherwise. | 41 // false otherwise. |
| 41 bool DialogsAreSuppressed(); | 42 bool DialogsAreSuppressed(); |
| 42 | 43 |
| 43 typedef std::vector<std::wstring> AssertionList; | 44 typedef std::vector<std::wstring> AssertionList; |
| 44 | 45 |
| 45 // Gets the list of fatal assertions in the current log file, and | 46 // Gets the list of fatal assertions in the current log file, and |
| 46 // returns the number of fatal assertions. (If you don't care | 47 // returns the number of fatal assertions. (If you don't care |
| 47 // about the actual list of assertions, you can pass in NULL.) | 48 // about the actual list of assertions, you can pass in NULL.) |
| 48 // NOTE: Since this reads the log file to determine the assertions, | 49 // NOTE: Since this reads the log file to determine the assertions, |
| 49 // this operation is O(n) over the length of the log. | 50 // this operation is O(n) over the length of the log. |
| 50 // NOTE: This can fail if the file is locked for writing. However, | 51 // NOTE: This can fail if the file is locked for writing. However, |
| 51 // this is unlikely as this function is most useful after | 52 // this is unlikely as this function is most useful after |
| 52 // the program writing the log has terminated. | 53 // the program writing the log has terminated. |
| 53 size_t GetFatalAssertions(AssertionList* assertions); | 54 size_t GetFatalAssertions(AssertionList* assertions); |
| 54 | 55 |
| 55 } // namespace logging | 56 } // namespace logging |
| 56 | 57 |
| 57 #endif | 58 #endif |
| OLD | NEW |