2019-04-11 12:58:23 +00:00
|
|
|
#ifndef LLARP_UTIL_LOG_STREAM_HPP
|
|
|
|
#define LLARP_UTIL_LOG_STREAM_HPP
|
|
|
|
#include <memory>
|
|
|
|
#include <string>
|
|
|
|
#include <util/loglevel.hpp>
|
|
|
|
#include <sstream>
|
2019-04-16 13:20:48 +00:00
|
|
|
#include <util/time.hpp>
|
|
|
|
|
2019-04-11 12:58:23 +00:00
|
|
|
namespace llarp
|
|
|
|
{
|
|
|
|
/// logger stream interface
|
|
|
|
struct ILogStream
|
|
|
|
{
|
2019-04-24 23:27:31 +00:00
|
|
|
virtual ~ILogStream()
|
|
|
|
{
|
|
|
|
}
|
2019-04-11 12:58:23 +00:00
|
|
|
|
|
|
|
virtual void
|
|
|
|
PreLog(std::stringstream& out, LogLevel lvl, const char* fname,
|
|
|
|
int lineno) const = 0;
|
|
|
|
virtual void
|
2019-04-16 13:20:48 +00:00
|
|
|
Print(LogLevel lvl, const char* filename, const std::string& msg) = 0;
|
2019-04-11 12:58:23 +00:00
|
|
|
|
|
|
|
virtual void
|
|
|
|
PostLog(std::stringstream& out) const = 0;
|
2019-04-16 13:20:48 +00:00
|
|
|
|
|
|
|
/// called every end of event loop tick
|
|
|
|
virtual void
|
|
|
|
Tick(llarp_time_t now) = 0;
|
2019-04-11 12:58:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
using ILogStream_ptr = std::unique_ptr< ILogStream >;
|
|
|
|
|
|
|
|
} // namespace llarp
|
|
|
|
#endif
|