eisgenerator 1.0.x
log.h
1//SPDX-License-Identifier: LGPL-3.0-or-later
21#pragma once
22#include <iostream>
23#include <string>
24
25namespace eis
26{
27
34class Log
35{
36public:
37
45
46private:
47 bool opened = false;
48 Level msglevel = DEBUG;
49 bool endline = true;
50
51 std::string getLabel(Level level);
52
53public:
54
55 static bool headers;
56 static Level level;
58 Log() {}
71 Log(Level type, bool endline = true);
72 ~Log();
73
74 template<class T> Log &operator<<(const T &msg)
75 {
76 if(msglevel >= level)
77 {
78 std::cout<<msg;
79 opened = true;
80 }
81 return *this;
82 }
83};
84
87}
Definition log.h:35
Log(Level type, bool endline=true)
Constructor.
static Level level
Minimum Level required for output to be printed.
Definition log.h:56
static bool headers
If true output will be prefixed with a header detailing the origin of the message.
Definition log.h:55
Level
Definition log.h:39
@ ERROR
Fatal errors
Definition log.h:43
@ INFO
Messages of intrest to the user incl.
Definition log.h:41
@ WARN
Non fatal errors or problems affecting performance or numeric precision
Definition log.h:42
@ DEBUG
Messages useful for debugging.
Definition log.h:40
eisgenerator Copyright (C) 2021 Carl Klemm
Definition basicmath.h:26