Updates from BitShares FC #22

Closed
nathanielhourt wants to merge 693 commits from dapp-support into latest-fc
Showing only changes of commit 8e1b47a460 - Show all commits

View file

@ -34,16 +34,24 @@ 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 );
try
{
fc::create_directories(cfg.filename.parent_path());
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 );
} else {
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()
@ -137,18 +145,7 @@ namespace fc {
file_appender::file_appender( const variant& args ) :
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(){}