claw 1.9.0
 
Loading...
Searching...
No Matches
log_level.hpp
Go to the documentation of this file.
1/*
2 CLAW - a C++ Library Absolutely Wonderful
3
4 CLAW is a free library without any particular aim but being useful to
5 anyone.
6
7 Copyright (C) 2005-2011 Julien Jorge
8
9 This library is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Lesser General Public
11 License as published by the Free Software Foundation; either
12 version 2.1 of the License, or (at your option) any later version.
13
14 This library is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Lesser General Public License for more details.
18
19 You should have received a copy of the GNU Lesser General Public
20 License along with this library; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22
23 contact: julien.jorge@stuff-o-matic.com
24*/
30#ifndef __CLAW_LOG_LEVEL_HPP__
31#define __CLAW_LOG_LEVEL_HPP__
32
33#include <string>
34
35#ifndef CLAW_LOGGER_EXPORT
36#ifdef CLAW_LOGGER_NO_EXPORT
37#define CLAW_LOGGER_EXPORT
38#else
39#ifdef _WIN32
40#ifdef claw_logger_EXPORTS
41#define CLAW_LOGGER_EXPORT __declspec(dllexport)
42#else
43#define CLAW_LOGGER_EXPORT __declspec(dllimport)
44#endif // def claw_logger_EXPORTS
45#else // def _WIN32
46#define CLAW_LOGGER_EXPORT
47#endif // def _WIN32
48#endif // def CLAW_LOGGER_NO_EXPORT
49#endif // ndef CLAW_LOGGER_EXPORT
50
51namespace claw
52{
57 class CLAW_LOGGER_EXPORT log_level
58 {
59 public:
60 log_level(int lvl);
61 log_level(int lvl, const std::string& s);
62 int get() const;
63 std::string get_string() const;
64
65 private:
67 const int m_level;
68
70 const std::string m_prefix;
71
72 }; // class log_level
73
78 CLAW_LOGGER_EXPORT extern log_level log_error;
79
84 CLAW_LOGGER_EXPORT extern log_level log_warning;
85
90 CLAW_LOGGER_EXPORT extern log_level log_verbose;
91
92}
93
94#endif // __CLAW_LOG_LEVEL_HPP__
Set the level of the next message for logger_system::operator<<().
Definition log_level.hpp:58
int get() const
Get the level value.
Definition log_level.cpp:62
log_level(int lvl)
Constructor.
Definition log_level.cpp:45
std::string get_string() const
Get the prefix.
Definition log_level.cpp:70
This is the main namespace.
CLAW_LOGGER_EXPORT log_level log_error
Use this level if something goes really bad and your application may crash.
CLAW_LOGGER_EXPORT log_level log_warning
Use this level if a small problem occurs and you can deal with it without crashing the application.
CLAW_LOGGER_EXPORT log_level log_verbose
Use this level if you want to inform the user about a situation that is not problematic.