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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 // Define different names for the BaseInitLoggingImpl() function depending on | 203 // Define different names for the BaseInitLoggingImpl() function depending on |
204 // whether NDEBUG is defined or not so that we'll fail to link if someone tries | 204 // whether NDEBUG is defined or not so that we'll fail to link if someone tries |
205 // to compile logging.cc with NDEBUG but includes logging.h without defining it, | 205 // to compile logging.cc with NDEBUG but includes logging.h without defining it, |
206 // or vice versa. | 206 // or vice versa. |
207 #if NDEBUG | 207 #if NDEBUG |
208 #define BaseInitLoggingImpl BaseInitLoggingImpl_built_with_NDEBUG | 208 #define BaseInitLoggingImpl BaseInitLoggingImpl_built_with_NDEBUG |
209 #else | 209 #else |
210 #define BaseInitLoggingImpl BaseInitLoggingImpl_built_without_NDEBUG | 210 #define BaseInitLoggingImpl BaseInitLoggingImpl_built_without_NDEBUG |
211 #endif | 211 #endif |
212 | 212 |
| 213 // Marker that separates log message and stack trace in log. |
| 214 BASE_EXPORT extern const char kStackTraceMarker[]; |
| 215 |
213 // Implementation of the InitLogging() method declared below. We use a | 216 // Implementation of the InitLogging() method declared below. We use a |
214 // more-specific name so we can #define it above without affecting other code | 217 // more-specific name so we can #define it above without affecting other code |
215 // that has named stuff "InitLogging". | 218 // that has named stuff "InitLogging". |
216 BASE_EXPORT bool BaseInitLoggingImpl(const LoggingSettings& settings); | 219 BASE_EXPORT bool BaseInitLoggingImpl(const LoggingSettings& settings); |
217 | 220 |
218 // Sets the log file name and other global logging state. Calling this function | 221 // Sets the log file name and other global logging state. Calling this function |
219 // is recommended, and is normally done at the beginning of application init. | 222 // is recommended, and is normally done at the beginning of application init. |
220 // If you don't call it, all the flags will be initialized to their default | 223 // If you don't call it, all the flags will be initialized to their default |
221 // values, and there is a race condition that may leak a critical section | 224 // values, and there is a race condition that may leak a critical section |
222 // object if two threads try to do the first log at the same time. | 225 // object if two threads try to do the first log at the same time. |
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1018 #elif NOTIMPLEMENTED_POLICY == 5 | 1021 #elif NOTIMPLEMENTED_POLICY == 5 |
1019 #define NOTIMPLEMENTED() do {\ | 1022 #define NOTIMPLEMENTED() do {\ |
1020 static bool logged_once = false;\ | 1023 static bool logged_once = false;\ |
1021 LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG;\ | 1024 LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG;\ |
1022 logged_once = true;\ | 1025 logged_once = true;\ |
1023 } while(0);\ | 1026 } while(0);\ |
1024 EAT_STREAM_PARAMETERS | 1027 EAT_STREAM_PARAMETERS |
1025 #endif | 1028 #endif |
1026 | 1029 |
1027 #endif // BASE_LOGGING_H_ | 1030 #endif // BASE_LOGGING_H_ |
OLD | NEW |