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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 // Sets the log file name and other global logging state. Calling this function | 202 // Sets the log file name and other global logging state. Calling this function |
203 // is recommended, and is normally done at the beginning of application init. | 203 // is recommended, and is normally done at the beginning of application init. |
204 // If you don't call it, all the flags will be initialized to their default | 204 // If you don't call it, all the flags will be initialized to their default |
205 // values, and there is a race condition that may leak a critical section | 205 // values, and there is a race condition that may leak a critical section |
206 // object if two threads try to do the first log at the same time. | 206 // object if two threads try to do the first log at the same time. |
207 // See the definition of the enums above for descriptions and default values. | 207 // See the definition of the enums above for descriptions and default values. |
208 // | 208 // |
209 // The default log file is initialized to "debug.log" in the application | 209 // The default log file is initialized to "debug.log" in the application |
210 // directory. You probably don't want this, especially since the program | 210 // directory. You probably don't want this, especially since the program |
211 // directory may not be writable on an enduser's system. | 211 // directory may not be writable on an enduser's system. |
| 212 // |
| 213 // This function may be called a second time to re-direct logging (e.g after |
| 214 // loging in to a user partition), however it should never be called more than |
| 215 // twice. |
212 inline bool InitLogging(const PathChar* log_file, | 216 inline bool InitLogging(const PathChar* log_file, |
213 LoggingDestination logging_dest, | 217 LoggingDestination logging_dest, |
214 LogLockingState lock_log, | 218 LogLockingState lock_log, |
215 OldFileDeletionState delete_old, | 219 OldFileDeletionState delete_old, |
216 DcheckState dcheck_state) { | 220 DcheckState dcheck_state) { |
217 return BaseInitLoggingImpl(log_file, logging_dest, lock_log, | 221 return BaseInitLoggingImpl(log_file, logging_dest, lock_log, |
218 delete_old, dcheck_state); | 222 delete_old, dcheck_state); |
219 } | 223 } |
220 | 224 |
221 // Sets the log level. Anything at or above this level will be written to the | 225 // Sets the log level. Anything at or above this level will be written to the |
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
955 namespace base { | 959 namespace base { |
956 | 960 |
957 class StringPiece; | 961 class StringPiece; |
958 | 962 |
959 // Allows StringPiece to be logged. | 963 // Allows StringPiece to be logged. |
960 BASE_EXPORT std::ostream& operator<<(std::ostream& o, const StringPiece& piece); | 964 BASE_EXPORT std::ostream& operator<<(std::ostream& o, const StringPiece& piece); |
961 | 965 |
962 } // namespace base | 966 } // namespace base |
963 | 967 |
964 #endif // BASE_LOGGING_H_ | 968 #endif // BASE_LOGGING_H_ |
OLD | NEW |