1 // Copyright 2007 Google Inc. All Rights Reserved.
3 #ifndef BASE_LOG_SEVERITY_H__
4 #define BASE_LOG_SEVERITY_H__
6 // Annoying stuff for windows -- makes sure clients can import these functions
7 #ifndef GOOGLE_GLOG_DLL_DECL
9 # define GOOGLE_GLOG_DLL_DECL __declspec(dllimport)
11 # define GOOGLE_GLOG_DLL_DECL
15 // Variables of type LogSeverity are widely taken to lie in the range
16 // [0, NUM_SEVERITIES-1]. Be careful to preserve this assumption if
17 // you ever need to change their values or add a new severity.
18 typedef int LogSeverity;
20 const int INFO = 0, WARNING = 1, ERROR = 2, FATAL = 3, NUM_SEVERITIES = 4;
22 // DFATAL is FATAL in debug mode, ERROR in normal mode
24 #define DFATAL_LEVEL ERROR
26 #define DFATAL_LEVEL FATAL
29 extern GOOGLE_GLOG_DLL_DECL const char* const LogSeverityNames[NUM_SEVERITIES];
31 // NDEBUG usage helpers related to (RAW_)DCHECK:
33 // DEBUG_MODE is for small !NDEBUG uses like
34 // if (DEBUG_MODE) foo.CheckThatFoo();
35 // instead of substantially more verbose
37 // foo.CheckThatFoo();
40 // IF_DEBUG_MODE is for small !NDEBUG uses like
41 // IF_DEBUG_MODE( string error; )
42 // DCHECK(Foo(&error)) << error;
43 // instead of substantially more verbose
46 // DCHECK(Foo(&error)) << error;
50 enum { DEBUG_MODE = 0 };
51 #define IF_DEBUG_MODE(x)
53 enum { DEBUG_MODE = 1 };
54 #define IF_DEBUG_MODE(x) x
57 #endif // BASE_LOG_SEVERITY_H__