Log console output during replay to file #985
This commit is contained in:
parent
2405081a18
commit
c544b384da
1 changed files with 17 additions and 19 deletions
|
|
@ -34,16 +34,25 @@ namespace fc {
|
||||||
public:
|
public:
|
||||||
impl( const config& c) : cfg( c )
|
impl( const config& c) : cfg( c )
|
||||||
{
|
{
|
||||||
if( cfg.rotate )
|
if( cfg.rotate )
|
||||||
{
|
{
|
||||||
FC_ASSERT( cfg.rotation_interval >= seconds( 1 ) );
|
FC_ASSERT( cfg.rotation_interval >= seconds( 1 ) );
|
||||||
FC_ASSERT( cfg.rotation_limit >= cfg.rotation_interval );
|
FC_ASSERT( cfg.rotation_limit >= cfg.rotation_interval );
|
||||||
|
|
||||||
|
rotate_files( true );
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
fc::create_directories(cfg.filename.parent_path());
|
||||||
|
|
||||||
|
if(!cfg.rotate)
|
||||||
_rotation_task = fc::async( [this]() { rotate_files( true ); }, "rotate_files(1)" );
|
out.open( cfg.filename, std::ios_base::out | std::ios_base::app);
|
||||||
}
|
}
|
||||||
|
catch( ... )
|
||||||
|
{
|
||||||
|
std::cerr << "error opening log file: " << cfg.filename.preferred_string() << "\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
~impl()
|
~impl()
|
||||||
|
|
@ -137,18 +146,7 @@ namespace fc {
|
||||||
file_appender::file_appender( const variant& args ) :
|
file_appender::file_appender( const variant& args ) :
|
||||||
my( new impl( args.as<config>( FC_MAX_LOG_OBJECT_DEPTH ) ) )
|
my( new impl( args.as<config>( FC_MAX_LOG_OBJECT_DEPTH ) ) )
|
||||||
{
|
{
|
||||||
try
|
|
||||||
{
|
|
||||||
fc::create_directories(my->cfg.filename.parent_path());
|
|
||||||
|
|
||||||
if(!my->cfg.rotate)
|
|
||||||
my->out.open( my->cfg.filename, std::ios_base::out | std::ios_base::app);
|
|
||||||
|
|
||||||
}
|
|
||||||
catch( ... )
|
|
||||||
{
|
|
||||||
std::cerr << "error opening log file: " << my->cfg.filename.preferred_string() << "\n";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
file_appender::~file_appender(){}
|
file_appender::~file_appender(){}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue