MCSB  2.0.0
High-throughput shared memory middleware
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
dbprinter.h
Go to the documentation of this file.
1 //=============================================================================
2 // This file is part of MCSB, the Multi-Client Shared Buffer
3 // Copyright (C) 2014 Gregory E. Allen and
4 // Applied Research Laboratories: The University of Texas at Austin
5 //
6 // MCSB is free software: you can redistribute it and/or modify it
7 // under the terms of the GNU Lesser General Public License as published
8 // by the Free Software Foundation, either version 2.1 of the License, or
9 // (at your option) any later version.
10 //
11 // MCSB is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License <http://www.gnu.org/licenses/lgpl.html>
15 // for more details.
16 //=============================================================================
17 
24 
25 #ifndef MCSB_dbprinter_h
26 #define MCSB_dbprinter_h
27 #pragma once
28 
29 #include <stdarg.h>
30 
31 namespace MCSB {
32 
34 
37 class dbprinter {
38  public:
40  dbprinter(int verbosity_=kNotice): verbosity(verbosity_) {}
41 
43  int dbprintf(int level, const char *fmt, ...) const;
45  int dbprintf(int level, const char *fmt, va_list ap) const;
46 
48  enum { kCritical=0, kError, kWarning, kNotice, kInfo, kDebug };
49 
51  int Verbosity(void) const { return verbosity; }
53  int Verbosity(int v) { return verbosity = v; }
54  private:
55  int verbosity;
56 };
57 
59 enum { kCritical=0, kError, kWarning, kNotice, kInfo, kDebug };
60 
61 } // namespace MCSB
62 
63 #endif
int Verbosity(void) const
Get the current verbosity level.
Definition: dbprinter.h:51
dbprinter(int verbosity_=kNotice)
Construct, setting the verbosity level.
Definition: dbprinter.h:40
A simple debug printer class used in MCSB.
Definition: dbprinter.h:37
int Verbosity(int v)
Set the current verbosity level.
Definition: dbprinter.h:53
int dbprintf(int level, const char *fmt,...) const
behaves like fprintf(stderr,...) if verbosity is at or above the specified level