update logging to create parent directory if it does not exist
This commit is contained in:
parent
d3a49c9f0f
commit
fd00bddcb4
2 changed files with 8 additions and 2 deletions
|
|
@ -16,6 +16,9 @@ namespace fc
|
|||
fc::string to_string( uint64_t );
|
||||
fc::string to_string( int64_t );
|
||||
fc::string to_string( uint16_t );
|
||||
#ifdef __APPLE__
|
||||
inline fc::string to_string( size_t s) { return to_string(uint64_t(s)); }
|
||||
#endif
|
||||
|
||||
typedef fc::optional<fc::string> ostring;
|
||||
class variant_object;
|
||||
|
|
|
|||
|
|
@ -7,13 +7,14 @@
|
|||
#include <fc/reflect/variant.hpp>
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
#include <fc/filesystem.hpp>
|
||||
|
||||
|
||||
namespace fc {
|
||||
class file_appender::impl : public fc::retainable {
|
||||
public:
|
||||
config cfg;
|
||||
ofstream out;
|
||||
config cfg;
|
||||
ofstream out;
|
||||
boost::mutex slock;
|
||||
};
|
||||
file_appender::config::config( const fc::path& p )
|
||||
|
|
@ -25,8 +26,10 @@ namespace fc {
|
|||
{
|
||||
try {
|
||||
my->cfg = args.as<config>();
|
||||
fc::create_directories( fc::path( my->cfg.filename.string() ).parent_path() );
|
||||
my->out.open( my->cfg.filename.string().c_str() );
|
||||
} catch ( ... ) {
|
||||
std::cerr << "error opening log file: " << my->cfg.filename.string() << "\n";
|
||||
//elog( "%s", fc::except_str().c_str() );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue