OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <cassert> | 10 #include <cassert> |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 | 245 |
246 // Gets the current log level. | 246 // Gets the current log level. |
247 BASE_EXPORT int GetMinLogLevel(); | 247 BASE_EXPORT int GetMinLogLevel(); |
248 | 248 |
249 // Used by LOG_IS_ON to lazy-evaluate stream arguments. | 249 // Used by LOG_IS_ON to lazy-evaluate stream arguments. |
250 BASE_EXPORT bool ShouldCreateLogMessage(int severity); | 250 BASE_EXPORT bool ShouldCreateLogMessage(int severity); |
251 | 251 |
252 // Gets the VLOG default verbosity level. | 252 // Gets the VLOG default verbosity level. |
253 BASE_EXPORT int GetVlogVerbosity(); | 253 BASE_EXPORT int GetVlogVerbosity(); |
254 | 254 |
255 // Gets the current vlog level for the given file (usually taken from | |
256 // __FILE__). | |
257 | |
258 // Note that |N| is the size *with* the null terminator. | 255 // Note that |N| is the size *with* the null terminator. |
259 BASE_EXPORT int GetVlogLevelHelper(const char* file_start, size_t N); | 256 BASE_EXPORT int GetVlogLevelHelper(const char* file_start, size_t N); |
260 | 257 |
| 258 // Gets the current vlog level for the given file (usually taken from __FILE__). |
261 template <size_t N> | 259 template <size_t N> |
262 int GetVlogLevel(const char (&file)[N]) { | 260 int GetVlogLevel(const char (&file)[N]) { |
263 return GetVlogLevelHelper(file, N); | 261 return GetVlogLevelHelper(file, N); |
264 } | 262 } |
265 | 263 |
266 // Sets the common items you want to be prepended to each log message. | 264 // Sets the common items you want to be prepended to each log message. |
267 // process and thread IDs default to off, the timestamp defaults to on. | 265 // process and thread IDs default to off, the timestamp defaults to on. |
268 // If this function is not called, logging defaults to writing the timestamp | 266 // If this function is not called, logging defaults to writing the timestamp |
269 // only. | 267 // only. |
270 BASE_EXPORT void SetLogItems(bool enable_process_id, bool enable_thread_id, | 268 BASE_EXPORT void SetLogItems(bool enable_process_id, bool enable_thread_id, |
(...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1163 #elif NOTIMPLEMENTED_POLICY == 5 | 1161 #elif NOTIMPLEMENTED_POLICY == 5 |
1164 #define NOTIMPLEMENTED() do {\ | 1162 #define NOTIMPLEMENTED() do {\ |
1165 static bool logged_once = false;\ | 1163 static bool logged_once = false;\ |
1166 LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG;\ | 1164 LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG;\ |
1167 logged_once = true;\ | 1165 logged_once = true;\ |
1168 } while(0);\ | 1166 } while(0);\ |
1169 EAT_STREAM_PARAMETERS | 1167 EAT_STREAM_PARAMETERS |
1170 #endif | 1168 #endif |
1171 | 1169 |
1172 #endif // BASE_LOGGING_H_ | 1170 #endif // BASE_LOGGING_H_ |
OLD | NEW |