OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 BASE_LOGGING_H_ | 5 #ifndef BASE_LOGGING_H_ |
6 #define BASE_LOGGING_H_ | 6 #define BASE_LOGGING_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <cassert> | 9 #include <cassert> |
10 #include <string> | 10 #include <string> |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 // Sets the log file name and other global logging state. Calling this function | 203 // Sets the log file name and other global logging state. Calling this function |
204 // is recommended, and is normally done at the beginning of application init. | 204 // is recommended, and is normally done at the beginning of application init. |
205 // If you don't call it, all the flags will be initialized to their default | 205 // If you don't call it, all the flags will be initialized to their default |
206 // values, and there is a race condition that may leak a critical section | 206 // values, and there is a race condition that may leak a critical section |
207 // object if two threads try to do the first log at the same time. | 207 // object if two threads try to do the first log at the same time. |
208 // See the definition of the enums above for descriptions and default values. | 208 // See the definition of the enums above for descriptions and default values. |
209 // | 209 // |
210 // The default log file is initialized to "debug.log" in the application | 210 // The default log file is initialized to "debug.log" in the application |
211 // directory. You probably don't want this, especially since the program | 211 // directory. You probably don't want this, especially since the program |
212 // directory may not be writable on an enduser's system. | 212 // directory may not be writable on an enduser's system. |
| 213 // |
| 214 // This function may be called a second time to re-direct logging (e.g after |
| 215 // loging in to a user partition), however it should never be called more than |
| 216 // twice. |
213 inline bool InitLogging(const PathChar* log_file, | 217 inline bool InitLogging(const PathChar* log_file, |
214 LoggingDestination logging_dest, | 218 LoggingDestination logging_dest, |
215 LogLockingState lock_log, | 219 LogLockingState lock_log, |
216 OldFileDeletionState delete_old, | 220 OldFileDeletionState delete_old, |
217 DcheckState dcheck_state) { | 221 DcheckState dcheck_state) { |
218 return BaseInitLoggingImpl(log_file, logging_dest, lock_log, | 222 return BaseInitLoggingImpl(log_file, logging_dest, lock_log, |
219 delete_old, dcheck_state); | 223 delete_old, dcheck_state); |
220 } | 224 } |
221 | 225 |
222 // Sets the log level. Anything at or above this level will be written to the | 226 // Sets the log level. Anything at or above this level will be written to the |
(...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
980 namespace base { | 984 namespace base { |
981 | 985 |
982 class StringPiece; | 986 class StringPiece; |
983 | 987 |
984 // Allows StringPiece to be logged. | 988 // Allows StringPiece to be logged. |
985 BASE_EXPORT std::ostream& operator<<(std::ostream& o, const StringPiece& piece); | 989 BASE_EXPORT std::ostream& operator<<(std::ostream& o, const StringPiece& piece); |
986 | 990 |
987 } // namespace base | 991 } // namespace base |
988 | 992 |
989 #endif // BASE_LOGGING_H_ | 993 #endif // BASE_LOGGING_H_ |
OLD | NEW |