43 :my(
std::make_shared<
detail::log_context_impl>() ){}
47 :my(
std::make_shared<
detail::log_context_impl>() )
58 :my(
std::make_shared<
detail::log_context_impl>() )
62 my->file = obj[
"file"].as_string();
63 my->line = obj[
"line"].as_uint64();
64 my->method = obj[
"method"].as_string();
65 my->hostname = obj[
"hostname"].as_string();
66 my->thread_name = obj[
"thread_name"].as_string();
67 if (obj.contains(
"task_name"))
68 my->task_name = obj[
"task_name"].as_string();
69 my->timestamp = obj[
"timestamp"].as<
time_point>();
70 if( obj.contains(
"context" ) )
71 my->context = obj[
"context"].as<
string>();
76 return my->thread_name +
" " + my->file +
":" +
fc::to_string(my->line) +
" " + my->method;
82 if (!my->context.empty())
83 my->context +=
" -> ";
143 else FC_THROW_EXCEPTION( bad_cast_exception,
"Failed to cast from Variant to log_level" );
145 "Expected 'all|debug|info|warn|error|off', but got '${variant}'",
182 o(
"level",
variant(my->level) )
185 (
"method", my->method )
186 (
"hostname", my->hostname )
187 (
"thread_name", my->thread_name )
188 (
"timestamp",
variant(my->timestamp) );
190 if( my->context.size() )
191 o(
"context", my->context );
198 :my(
std::make_shared<
detail::log_message_impl>() ){}
201 :my(
std::make_shared<
detail::log_message_impl>(
std::move(ctx)) )
203 my->format = std::move(
format);
204 my->args = std::move(args);
210 my->format = v.
get_object()[
"format"].as_string();
211 my->args = v.
get_object()[
"data"].get_object();
217 (
"format", my->format )
218 (
"data", my->args );
232 const bool minimize =
true;
log_message_impl(log_context &&ctx)
provides information about where and when a log message was generated.
void append_context(const fc::string &c)
log_level get_log_level() const
string get_method() const
string get_thread_name() const
string get_task_name() const
time_point get_timestamp() const
uint64_t get_line_number() const
string get_host_name() const
variant to_variant() const
string get_context() const
aggregates a message along with the context and associated meta-information.
string get_message() const
string get_limited_message() const
log_context get_context() const
variant to_variant() const
string get_format() const
variant_object get_data() const
An order-preserving dictionary of variants.
wraps boost::filesystem::path to provide platform independent path manipulation.
fc::path filename() const
std::string generic_string() const
An order-preserving dictionary of variants.
stores null, int64, uint64, double, bool, string, std::vector<variant>, and variant_object's.
variant_object & get_object()
Defines exception's used by fc.
#define FC_THROW_EXCEPTION(EXCEPTION, FORMAT,...)
#define FC_RETHROW_EXCEPTIONS(LOG_LEVEL, FORMAT,...)
Catchs all exception's, std::exceptions, and ... and rethrows them after appending the provided log m...
Defines types and helper macros necessary for generating log messages.
fc::string to_string(double)
const string & get_thread_name()
void from_variant(const fc::variant &v, sysio::chain::chain_id_type &cid)
fc::string format_string(const fc::string &, const variant_object &, bool minimize=false)
void to_variant(const sysio::chain::shared_public_key &var, fc::variant &vo)
unsigned __int64 uint64_t