BitShares-Core
7.0.2
BitShares blockchain node software and command-line wallet software
|
Go to the documentation of this file.
45 :my(
std::make_shared<detail::log_context_impl>() ){}
49 :my(
std::make_shared<detail::log_context_impl>() )
58 my->task_name = current_task_desc ? current_task_desc :
"?unnamed?";
62 :my(
std::make_shared<detail::log_context_impl>() )
65 my->level = obj[
"level"].as<
log_level>(max_depth);
66 my->file = obj[
"file"].as_string();
67 my->line = obj[
"line"].as_uint64();
68 my->method = obj[
"method"].as_string();
69 my->hostname = obj[
"hostname"].as_string();
70 my->thread_name = obj[
"thread_name"].as_string();
71 if (obj.contains(
"task_name"))
72 my->task_name = obj[
"task_name"].as_string();
73 my->timestamp = obj[
"timestamp"].as<
time_point>(max_depth);
74 if( obj.contains(
"context" ) )
75 my->context = obj[
"context"].as<
string>(max_depth);
80 return my->thread_name +
" " + my->file +
":" +
fc::to_string(my->line) +
" " + my->method;
86 if (!my->context.empty())
87 my->context +=
" -> ";
147 else FC_THROW_EXCEPTION( bad_cast_exception,
"Failed to cast from Variant to log_level" );
149 "Expected 'all|debug|info|warn|error|off', but got '${variant}'",
169 o(
"level",
variant(my->level, max_depth) )
172 (
"method", my->method )
173 (
"hostname", my->hostname )
174 (
"thread_name", my->thread_name )
175 (
"timestamp",
variant(my->timestamp, max_depth) );
177 if( my->context.size() )
178 o(
"context", my->context );
185 :my(
std::make_shared<detail::log_message_impl>() ){}
188 :my(
std::make_shared<detail::log_message_impl>(
std::move(ctx)) )
190 my->format = std::move(format);
191 my->args = std::move(args);
195 :my(
std::make_shared<detail::log_message_impl>(
log_context( v.get_object()[
"context"], max_depth ) ) )
197 my->format = v.
get_object()[
"format"].as_string();
198 my->args = v.
get_object()[
"data"].get_object();
204 (
"context", my->context )
205 (
"format", my->format )
206 (
"data", my->args );
variant to_variant(uint32_t max_depth) const
variant_object get_data() const
static thread & current()
An order-perserving dictionary of variant's.
An order-perserving dictionary of variant's.
std::string to_string(double)
void append_context(const std::string &c)
variant to_variant(uint32_t max_depth) const
std::string get_format() const
log_level get_log_level() const
std::string as_string() const
std::string get_thread_name() const
log_message_impl(log_context &&ctx)
void from_variant(const variant &var, flat_set< T, A... > &vo, uint32_t _max_depth)
std::string get_context() const
uint64_t get_line_number() const
const char * current_task_desc() const
wraps boost::filesystem::path to provide platform independent path manipulation.
std::string get_file() const
provides information about where and when a log message was generated.
std::string get_host_name() const
void to_variant(const flat_set< T, A... > &var, variant &vo, uint32_t _max_depth)
time_point get_timestamp() const
std::string get_task_name() const
std::string format_string(const std::string &, const variant_object &, uint32_t max_object_depth=200)
std::string generic_string() const
aggregates a message along with the context and associated meta-information.
variant_object & get_object()
stores null, int64, uint64, double, bool, string, std::vector<variant>, and variant_object's.
Defines exception's used by fc.
#define FC_RETHROW_EXCEPTIONS(LOG_LEVEL, FORMAT,...)
Catchs all exception's, std::exceptions, and ... and rethrows them after appending the provided log m...
std::string get_method() const
#define FC_THROW_EXCEPTION(EXCEPTION, FORMAT,...)
log_context get_context() const
Defines types and helper macros necessary for generating log messages.
std::string to_string() const
fc::path filename() const
const string & name() const
returns the name given by set_name() for this thread
std::string get_message() const