Home | History | Annotate | Download | only in base
      1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #ifndef BASE_LOG_SEVERITY_H_
      6 #define BASE_LOG_SEVERITY_H_
      7 
      8 #include "base/port.h"
      9 #include "base/commandlineflags.h"
     10 
     11 // Variables of type LogSeverity are widely taken to lie in the range
     12 // [0, NUM_SEVERITIES-1].  Be careful to preserve this assumption if
     13 // you ever need to change their values or add a new severity.
     14 typedef int LogSeverity;
     15 
     16 const int INFO = 0, WARNING = 1, ERROR = 2, FATAL = 3, NUM_SEVERITIES = 4;
     17 
     18 // DFATAL is FATAL in debug mode, ERROR in normal mode
     19 #ifdef NDEBUG
     20 #define DFATAL_LEVEL ERROR
     21 #else
     22 #define DFATAL_LEVEL FATAL
     23 #endif
     24 
     25 extern const char* const LogSeverityNames[NUM_SEVERITIES];
     26 
     27 // Some flags needed for VLOG and RAW_VLOG
     28 DECLARE_int32(v);
     29 DECLARE_bool(silent_init);
     30 
     31 // NDEBUG usage helpers related to (RAW_)DCHECK:
     32 //
     33 // DEBUG_MODE is for small !NDEBUG uses like
     34 //   if (DEBUG_MODE) foo.CheckThatFoo();
     35 // instead of substantially more verbose
     36 //   #ifndef NDEBUG
     37 //     foo.CheckThatFoo();
     38 //   #endif
     39 //
     40 #ifdef NDEBUG
     41 enum { DEBUG_MODE = 0 };
     42 #else
     43 enum { DEBUG_MODE = 1 };
     44 #endif
     45 
     46 #endif  // BASE_LOG_SEVERITY_H_
     47