LogUtil.hpp
Go to the documentation of this file.
1/*
2 Copyright 2015 Statoil ASA.
3
4 This file is part of the Open Porous Media project (OPM).
5
6 OPM is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 OPM 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
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with OPM. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#ifndef OPM_LOG_UTIL_HPP
21#define OPM_LOG_UTIL_HPP
22
23#include <cstdint>
24#include <string>
25
27
28namespace Opm {
29
30namespace Log {
31 namespace MessageType {
32 const int64_t Debug = 1; /* Excessive information */
33 const int64_t Note = 2; /* Information that should only go into print file.*/
34 const int64_t Info = 4; /* Normal status information */
35 const int64_t Warning = 8; /* Input anomaly - possible error */
36 const int64_t Error = 16; /* Error in the input data - should probably exit. */
37 const int64_t Problem = 32; /* Calculation problems - e.g. convergence failure. */
38 const int64_t Bug = 64; /* An inconsistent state has been encountered in the simulator - should probably exit. */
39 }
40
44
47 namespace AnsiTerminalColors {
48 const std::string none = "\033[0m";
49 const std::string red = "\033[31m";
50 const std::string red_strong = "\033[31;1m";
51 const std::string yellow = "\033[33m";
52 const std::string yellow_strong = "\033[33;1m";
53 const std::string blue = "\033[34m";
54 const std::string blue_strong = "\033[34;1m";
55 const std::string magenta = "\033[35m";
56 const std::string magenta_strong = "\033[35;1m";
57 const std::string default_color = "\033[39m";
58 }
59
60
61 bool isPower2(int64_t x);
62 std::string fileMessage(const Location& location, const std::string& msg);
63 std::string fileMessage(int64_t messageType , const Location& location , const std::string& msg);
64 std::string prefixMessage(int64_t messageType , const std::string& msg);
65 std::string colorCodeMessage(int64_t messageType , const std::string& msg);
66
67}
68}
69
70#endif
const char *const string
Definition: cJSON.h:170
Definition: Location.hpp:25
const std::string magenta
Definition: LogUtil.hpp:55
const std::string blue
Definition: LogUtil.hpp:53
const std::string magenta_strong
Definition: LogUtil.hpp:56
const std::string none
Definition: LogUtil.hpp:48
const std::string red_strong
Definition: LogUtil.hpp:50
const std::string yellow
Definition: LogUtil.hpp:51
const std::string blue_strong
Definition: LogUtil.hpp:54
const std::string red
Definition: LogUtil.hpp:49
const std::string yellow_strong
Definition: LogUtil.hpp:52
const std::string default_color
Definition: LogUtil.hpp:57
const int64_t Bug
Definition: LogUtil.hpp:38
const int64_t Problem
Definition: LogUtil.hpp:37
const int64_t Debug
Definition: LogUtil.hpp:32
const int64_t Info
Definition: LogUtil.hpp:34
const int64_t Note
Definition: LogUtil.hpp:33
const int64_t Error
Definition: LogUtil.hpp:36
const int64_t Warning
Definition: LogUtil.hpp:35
const int64_t DefaultMessageTypes
Definition: LogUtil.hpp:41
const int64_t NoDebugMessageTypes
Definition: LogUtil.hpp:42
bool isPower2(int64_t x)
std::string colorCodeMessage(int64_t messageType, const std::string &msg)
const int64_t StdoutMessageTypes
Definition: LogUtil.hpp:43
std::string prefixMessage(int64_t messageType, const std::string &msg)
std::string fileMessage(const Location &location, const std::string &msg)
Definition: A.hpp:4
x y t t *t x y t t t x y t t t x *y t *t t x *y t *t t x y t t t x y t t t x(y+z)