1 // Copyright 2007 Google Inc. All Rights Reserved.
3 #ifndef BASE_LOG_SEVERITY_H__
4 #define BASE_LOG_SEVERITY_H__
6 // Variables of type LogSeverity are widely taken to lie in the range
7 // [0, NUM_SEVERITIES-1]. Be careful to preserve this assumption if
8 // you ever need to change their values or add a new severity.
9 typedef int LogSeverity;
11 const int INFO = 0, WARNING = 1, ERROR = 2, FATAL = 3, NUM_SEVERITIES = 4;
13 // DFATAL is FATAL in debug mode, ERROR in normal mode
15 #define DFATAL_LEVEL ERROR
17 #define DFATAL_LEVEL FATAL
20 extern const char* const LogSeverityNames[NUM_SEVERITIES];
22 // NDEBUG usage helpers related to (RAW_)DCHECK:
24 // DEBUG_MODE is for small !NDEBUG uses like
25 // if (DEBUG_MODE) foo.CheckThatFoo();
26 // instead of substantially more verbose
28 // foo.CheckThatFoo();
31 // IF_DEBUG_MODE is for small !NDEBUG uses like
32 // IF_DEBUG_MODE( string error; )
33 // DCHECK(Foo(&error)) << error;
34 // instead of substantially more verbose
37 // DCHECK(Foo(&error)) << error;
41 enum { DEBUG_MODE = 0 };
42 #define IF_DEBUG_MODE(x)
44 enum { DEBUG_MODE = 1 };
45 #define IF_DEBUG_MODE(x) x
48 #endif // BASE_LOG_SEVERITY_H__