From c720d6451e21c271a9fcc016dc94dd4ade453c87 Mon Sep 17 00:00:00 2001 From: Valera Cogut Date: Fri, 21 Sep 2018 10:55:16 +0300 Subject: [PATCH] Log console output during replay to file #985 (2nd simpler solution) --- src/log/file_appender.cpp | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/src/log/file_appender.cpp b/src/log/file_appender.cpp index 8e5c44cce..606a14fd2 100644 --- a/src/log/file_appender.cpp +++ b/src/log/file_appender.cpp @@ -34,16 +34,13 @@ namespace fc { public: impl( const config& c) : cfg( c ) { - if( cfg.rotate ) - { - FC_ASSERT( cfg.rotation_interval >= seconds( 1 ) ); - FC_ASSERT( cfg.rotation_limit >= cfg.rotation_interval ); - - - + if( cfg.rotate ) + { + FC_ASSERT( cfg.rotation_interval >= seconds( 1 ) ); + FC_ASSERT( cfg.rotation_limit >= cfg.rotation_interval ); - _rotation_task = fc::async( [this]() { rotate_files( true ); }, "rotate_files(1)" ); - } + rotate_files( true ); + } } ~impl() @@ -137,18 +134,7 @@ namespace fc { file_appender::file_appender( const variant& args ) : my( new impl( args.as( 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(){}