2013-02-05 05:06:16 +00:00
|
|
|
#pragma once
|
2014-07-03 05:16:46 +00:00
|
|
|
|
|
|
|
|
#include <fc/filesystem.hpp>
|
2013-06-05 19:19:00 +00:00
|
|
|
#include <fc/log/appender.hpp>
|
|
|
|
|
#include <fc/log/logger.hpp>
|
2014-07-02 21:36:21 +00:00
|
|
|
#include <fc/time.hpp>
|
2013-02-05 05:06:16 +00:00
|
|
|
|
|
|
|
|
namespace fc {
|
|
|
|
|
|
|
|
|
|
class file_appender : public appender {
|
|
|
|
|
public:
|
|
|
|
|
struct config {
|
|
|
|
|
config( const fc::path& p = "log.txt" );
|
|
|
|
|
|
|
|
|
|
fc::string format;
|
|
|
|
|
fc::path filename;
|
2015-03-26 00:07:19 +00:00
|
|
|
bool flush = true;
|
|
|
|
|
bool rotate = false;
|
2014-07-02 21:36:21 +00:00
|
|
|
microseconds rotation_interval;
|
|
|
|
|
microseconds rotation_limit;
|
2016-08-12 22:39:57 +00:00
|
|
|
bool rotation_compression = false;
|
2018-03-19 16:35:57 +00:00
|
|
|
uint32_t max_object_depth;
|
2013-02-05 05:06:16 +00:00
|
|
|
};
|
2013-06-05 19:19:00 +00:00
|
|
|
file_appender( const variant& args );
|
2013-02-05 05:06:16 +00:00
|
|
|
~file_appender();
|
2014-07-02 21:36:21 +00:00
|
|
|
virtual void log( const log_message& m )override;
|
2013-02-05 05:06:16 +00:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
class impl;
|
|
|
|
|
fc::shared_ptr<impl> my;
|
|
|
|
|
};
|
|
|
|
|
} // namespace fc
|
|
|
|
|
|
2013-06-05 19:19:00 +00:00
|
|
|
#include <fc/reflect/reflect.hpp>
|
2014-07-03 05:16:46 +00:00
|
|
|
FC_REFLECT( fc::file_appender::config,
|
2018-03-19 16:35:57 +00:00
|
|
|
(format)(filename)(flush)(rotate)(rotation_interval)(rotation_limit)(rotation_compression)(max_object_depth) )
|