[email protected] | 0f65b52d | 2012-02-09 21:02:47 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
license.bot | bf09a50 | 2008-08-24 00:55:55 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 4 | |
michaelpg | 33eea59 | 2017-01-19 01:34:56 | [diff] [blame] | 5 | #ifndef CHROME_COMMON_LOGGING_CHROME_H_ |
6 | #define CHROME_COMMON_LOGGING_CHROME_H_ | ||||
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 7 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 8 | #include "base/logging.h" |
[email protected] | 3164fa82 | 2013-06-28 15:32:41 | [diff] [blame] | 9 | #include "base/time/time.h" |
avi | 2729e44 | 2015-12-26 05:27:45 | [diff] [blame] | 10 | #include "build/build_config.h" |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 11 | |
[email protected] | a3ef483 | 2013-02-02 05:12:33 | [diff] [blame] | 12 | namespace base { |
[email protected] | 2f3b1cc | 2014-03-17 23:07:15 | [diff] [blame] | 13 | class CommandLine; |
[email protected] | 73e2348 | 2009-08-13 00:26:58 | [diff] [blame] | 14 | class FilePath; |
[email protected] | a3ef483 | 2013-02-02 05:12:33 | [diff] [blame] | 15 | } |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 16 | |
17 | namespace logging { | ||||
18 | |||||
19 | // Call to initialize logging for Chrome. This sets up the chrome-specific | ||||
20 | // logfile naming scheme and might do other things like log modules and | ||||
21 | // setting levels in the future. | ||||
22 | // | ||||
23 | // The main process might want to delete any old log files on startup by | ||||
24 | // setting delete_old_log_file, but the renderer processes should not, or | ||||
25 | // they will delete each others' logs. | ||||
26 | // | ||||
27 | // XXX | ||||
28 | // Setting suppress_error_dialogs to true disables any dialogs that would | ||||
29 | // normally appear for assertions and crashes, and makes any catchable | ||||
30 | // errors (namely assertions) available via GetSilencedErrorCount() | ||||
31 | // and GetSilencedError(). | ||||
[email protected] | 2f3b1cc | 2014-03-17 23:07:15 | [diff] [blame] | 32 | void InitChromeLogging(const base::CommandLine& command_line, |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 33 | OldFileDeletionState delete_old_log_file); |
34 | |||||
[email protected] | 77ee1b1 | 2010-06-14 16:21:30 | [diff] [blame] | 35 | #if defined(OS_CHROMEOS) |
[email protected] | cc5ff985 | 2014-07-23 22:29:29 | [diff] [blame] | 36 | // Get the log file directory path. |
37 | base::FilePath GetSessionLogDir(const base::CommandLine& command_line); | ||||
38 | |||||
[email protected] | 0750b144 | 2010-11-02 21:59:37 | [diff] [blame] | 39 | // Get the log file location. |
[email protected] | 2f3b1cc | 2014-03-17 23:07:15 | [diff] [blame] | 40 | base::FilePath GetSessionLogFile(const base::CommandLine& command_line); |
[email protected] | 0750b144 | 2010-11-02 21:59:37 | [diff] [blame] | 41 | |
42 | // Redirects chrome logging to the appropriate session log dir. | ||||
[email protected] | 2f3b1cc | 2014-03-17 23:07:15 | [diff] [blame] | 43 | void RedirectChromeLogging(const base::CommandLine& command_line); |
[email protected] | 77ee1b1 | 2010-06-14 16:21:30 | [diff] [blame] | 44 | #endif |
45 | |||||
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 46 | // Call when done using logging for Chrome. |
47 | void CleanupChromeLogging(); | ||||
48 | |||||
49 | // Returns the fully-qualified name of the log file. | ||||
[email protected] | a3ef483 | 2013-02-02 05:12:33 | [diff] [blame] | 50 | base::FilePath GetLogFileName(); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 51 | |
erikwright | dfe2976 | 2015-03-16 16:06:46 | [diff] [blame] | 52 | // Returns true when error/assertion dialogs are not to be shown, false |
53 | // otherwise. | ||||
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 54 | bool DialogsAreSuppressed(); |
55 | |||||
[email protected] | 395a039 | 2012-04-12 15:35:03 | [diff] [blame] | 56 | // Inserts timestamp before file extension in the format |
57 | // "_yymmdd-hhmmss". | ||||
[email protected] | a3ef483 | 2013-02-02 05:12:33 | [diff] [blame] | 58 | base::FilePath GenerateTimestampedName(const base::FilePath& base_path, |
59 | base::Time timestamp); | ||||
[email protected] | e0ced0c7 | 2011-11-14 21:03:50 | [diff] [blame] | 60 | } // namespace logging |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 61 | |
[email protected] | 11f485728 | 2009-11-13 19:56:17 | [diff] [blame] | 62 | #endif // CHROME_COMMON_LOGGING_CHROME_H_ |