add support for bayergb
This commit is contained in:
53
log.h
53
log.h
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Cam
|
||||
* Lubricant Detecter
|
||||
* Copyright (C) 2021 Carl Klemm
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@ -21,6 +21,9 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
namespace cam
|
||||
{
|
||||
|
||||
class Log
|
||||
{
|
||||
public:
|
||||
@ -37,51 +40,17 @@ private:
|
||||
bool opened = false;
|
||||
Level msglevel = DEBUG;
|
||||
|
||||
inline std::string getLabel(Level level)
|
||||
{
|
||||
std::string label;
|
||||
switch(level)
|
||||
{
|
||||
case DEBUG:
|
||||
label = "DEBUG";
|
||||
break;
|
||||
case INFO:
|
||||
label = "INFO ";
|
||||
break;
|
||||
case WARN:
|
||||
label = "WARN ";
|
||||
break;
|
||||
case ERROR:
|
||||
label = "ERROR";
|
||||
break;
|
||||
}
|
||||
return label;
|
||||
}
|
||||
std::string getLabel(Level level);
|
||||
|
||||
public:
|
||||
|
||||
|
||||
inline static bool headers = false;
|
||||
inline static Level level = WARN;
|
||||
static bool headers;
|
||||
static Level level;
|
||||
static bool endline;
|
||||
|
||||
Log() {}
|
||||
Log(Level type)
|
||||
{
|
||||
msglevel = type;
|
||||
if(headers)
|
||||
{
|
||||
operator << ("["+getLabel(type)+"]");
|
||||
}
|
||||
}
|
||||
|
||||
~Log()
|
||||
{
|
||||
if(opened)
|
||||
{
|
||||
std::cout<<'\n';
|
||||
}
|
||||
opened = false;
|
||||
}
|
||||
Log(Level type);
|
||||
~Log();
|
||||
|
||||
template<class T> Log &operator<<(const T &msg)
|
||||
{
|
||||
@ -93,3 +62,5 @@ public:
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user