My Project
LogUtil.hpp
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 
26 namespace Opm {
27 
28 class KeywordLocation;
29 
30 namespace 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 
41  const int64_t DefaultMessageTypes = MessageType::Debug + MessageType::Note + MessageType::Info + MessageType::Warning + MessageType::Error + MessageType::Problem + MessageType::Bug;
42  const int64_t NoDebugMessageTypes = MessageType::Info + MessageType::Note + MessageType::Warning + MessageType::Error + MessageType::Problem + MessageType::Bug;
43  const int64_t StdoutMessageTypes = MessageType::Info + MessageType::Warning + MessageType::Error + MessageType::Problem + MessageType::Bug;
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 KeywordLocation& location, const std::string& msg);
63  std::string fileMessage(int64_t messageType , const KeywordLocation& 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
Definition: KeywordLocation.hpp:27
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:29