| Index: base/logging.h
|
| diff --git a/base/logging.h b/base/logging.h
|
| index 647f5804da51cfd3924cff6e2e59d717ce46e83d..e70c9cd41946475879ec71ee8d0b9d4aa3fa280d 100644
|
| --- a/base/logging.h
|
| +++ b/base/logging.h
|
| @@ -173,6 +173,11 @@ enum DcheckState {
|
| ENABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS
|
| };
|
|
|
| +enum DlogState {
|
| + DISABLE_DLOG_FOR_NON_OFFICIAL_RELEASE_BUILDS,
|
| + ENABLE_DLOG_FOR_NON_OFFICIAL_RELEASE_BUILDS
|
| +};
|
| +
|
| // TODO(avi): do we want to do a unification of character types here?
|
| #if defined(OS_WIN)
|
| typedef wchar_t PathChar;
|
| @@ -197,7 +202,8 @@ BASE_EXPORT bool BaseInitLoggingImpl(const PathChar* log_file,
|
| LoggingDestination logging_dest,
|
| LogLockingState lock_log,
|
| OldFileDeletionState delete_old,
|
| - DcheckState dcheck_state);
|
| + DcheckState dcheck_state,
|
| + DlogState dlog_state);
|
|
|
| // Sets the log file name and other global logging state. Calling this function
|
| // is recommended, and is normally done at the beginning of application init.
|
| @@ -213,9 +219,10 @@ inline bool InitLogging(const PathChar* log_file,
|
| LoggingDestination logging_dest,
|
| LogLockingState lock_log,
|
| OldFileDeletionState delete_old,
|
| - DcheckState dcheck_state) {
|
| + DcheckState dcheck_state,
|
| + DlogState dlog_state) {
|
| return BaseInitLoggingImpl(log_file, logging_dest, lock_log,
|
| - delete_old, dcheck_state);
|
| + delete_old, dcheck_state, dlog_state);
|
| }
|
|
|
| // Sets the log level. Anything at or above this level will be written to the
|
| @@ -542,14 +549,9 @@ DEFINE_CHECK_OP_IMPL(GT, > )
|
| #define ENABLE_DLOG 0
|
| #define ENABLE_DCHECK 0
|
|
|
| -#elif defined(NDEBUG)
|
| -// Otherwise, if we're a release build, remove DLOGs but not DCHECKs
|
| -// (since those can still be turned on via a command-line flag).
|
| -#define ENABLE_DLOG 0
|
| -#define ENABLE_DCHECK 1
|
| -
|
| #else
|
| -// Otherwise, we're a debug build so enable DLOGs and DCHECKs.
|
| +// For both non offical release builds and debug builds we enable them.
|
| +// In case of non official release builds they could be enabled by commandline.
|
| #define ENABLE_DLOG 1
|
| #define ENABLE_DCHECK 1
|
| #endif
|
| @@ -558,6 +560,23 @@ DEFINE_CHECK_OP_IMPL(GT, > )
|
|
|
| #if ENABLE_DLOG
|
|
|
| +#if defined(NDEBUG)
|
| +BASE_EXPORT extern DlogState g_dlog_state;
|
| +
|
| +#define DLOG_ENABLED (::logging::g_dlog_state == \
|
| + ::logging::ENABLE_DLOG_FOR_NON_OFFICIAL_RELEASE_BUILDS)
|
| +#define DLOG_IS_ON(severity) (DLOG_ENABLED && LOG_IS_ON(severity))
|
| +#define DLOG_IF(severity, condition) \
|
| + LOG_IF(severity,(DLOG_IS_ON(severity) && condition))
|
| +#define DLOG_ASSERT(condition) LOG_ASSERT(DLOG_ENABLED && condition)
|
| +#define DPLOG_IF(severity, condition) PLOG_IF(severity, \
|
| + (DLOG_IS_ON(severity) && condition))
|
| +#define DVLOG_IF(verboselevel, condition) \
|
| + VLOG_IF(verboselevel, (DLOG_ENABLED && condition))
|
| +#define DVPLOG_IF(verboselevel, condition) \
|
| + VPLOG_IF(verboselevel, (DLOG_ENABLED && condition))
|
| +#else // NDEBUG
|
| +// Debug builds.
|
| #define DLOG_IS_ON(severity) LOG_IS_ON(severity)
|
| #define DLOG_IF(severity, condition) LOG_IF(severity, condition)
|
| #define DLOG_ASSERT(condition) LOG_ASSERT(condition)
|
| @@ -565,6 +584,8 @@ DEFINE_CHECK_OP_IMPL(GT, > )
|
| #define DVLOG_IF(verboselevel, condition) VLOG_IF(verboselevel, condition)
|
| #define DVPLOG_IF(verboselevel, condition) VPLOG_IF(verboselevel, condition)
|
|
|
| +#endif // NDEBUG
|
| +
|
| #else // ENABLE_DLOG
|
|
|
| // If ENABLE_DLOG is off, we want to avoid emitting any references to
|
|
|