2014-10-11 02:37:33 +08:00
|
|
|
#pragma once
|
|
|
|
|
2014-10-24 06:59:39 +08:00
|
|
|
#include<initializer_list>
|
|
|
|
#include<memory>
|
|
|
|
#include<chrono>
|
|
|
|
|
2014-10-11 02:37:33 +08:00
|
|
|
namespace c11log
|
|
|
|
{
|
2014-10-24 06:59:39 +08:00
|
|
|
class formatter;
|
|
|
|
namespace sinks {
|
|
|
|
class sink;
|
|
|
|
}
|
2014-10-11 02:37:33 +08:00
|
|
|
|
2014-10-24 06:59:39 +08:00
|
|
|
// Common types across the lib
|
2014-10-11 02:37:33 +08:00
|
|
|
using log_clock = std::chrono::system_clock;
|
2014-10-24 06:59:39 +08:00
|
|
|
using sink_ptr = std::shared_ptr < sinks::sink > ;
|
|
|
|
using sinks_init_list = std::initializer_list < sink_ptr > ;
|
|
|
|
using formatter_ptr = std::shared_ptr<c11log::formatter>;
|
|
|
|
|
|
|
|
//Log level enum
|
2014-10-11 02:37:33 +08:00
|
|
|
namespace level
|
|
|
|
{
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
TRACE,
|
|
|
|
DEBUG,
|
|
|
|
INFO,
|
|
|
|
WARNING,
|
|
|
|
ERROR,
|
|
|
|
CRITICAL,
|
|
|
|
NONE = 99
|
|
|
|
} level_enum;
|
|
|
|
|
|
|
|
static const char* level_names[] { "trace", "debug", "info", "warning", "error", "critical", "fatal" };
|
|
|
|
inline const char* to_str(c11log::level::level_enum l)
|
|
|
|
{
|
|
|
|
return level_names[l];
|
|
|
|
}
|
|
|
|
} //level
|
|
|
|
} //c11log
|