Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
log_message.hpp
Go to the documentation of this file.
1#pragma once
6#include <fc/time.hpp>
8#include <memory>
9
10namespace fc
11{
12 namespace detail
13 {
14 class log_context_impl;
15 class log_message_impl;
16 }
17
22 {
23 public:
40 explicit log_level( int v ):value( static_cast<values>(v)){}
41 operator int()const { return value; }
42 string to_string()const;
44 };
45
46 void to_variant( log_level e, variant& v );
47 void from_variant( const variant& e, log_level& ll );
48
56 {
57 public:
60 const char* file,
61 uint64_t line,
62 const char* method );
64 explicit log_context( const variant& v );
65 variant to_variant()const;
66
67 string get_file()const;
69 string get_method()const;
70 string get_thread_name()const;
71 string get_task_name()const;
72 string get_host_name()const;
75 string get_context()const;
76
77 void append_context( const fc::string& c );
78
79 string to_string()const;
80 private:
81 std::shared_ptr<detail::log_context_impl> my;
82 };
83
84 void to_variant( const log_context& l, variant& v );
85 void from_variant( const variant& l, log_context& c );
86
106 {
107 public:
108 log_message();
112 log_message( log_context ctx, std::string format, variant_object args = variant_object() );
113 ~log_message();
114
115 log_message( const variant& v );
116 variant to_variant()const;
117
118 string get_message()const;
123 string get_limited_message()const;
124
126 string get_format()const;
128
129 private:
130 std::shared_ptr<detail::log_message_impl> my;
131 };
132
133 void to_variant( const log_message& l, variant& v );
134 void from_variant( const variant& l, log_message& c );
135
136 typedef std::vector<log_message> log_messages;
137
138
139} // namespace fc
140
142
143#ifndef __func__
144#define __func__ __FUNCTION__
145#endif
146
153#define FC_LOG_CONTEXT(LOG_LEVEL) \
154 fc::log_context( fc::log_level::LOG_LEVEL, __FILE__, __LINE__, __func__ )
155
165#define FC_LOG_MESSAGE( LOG_LEVEL, FORMAT, ... ) \
166 fc::log_message( FC_LOG_CONTEXT(LOG_LEVEL), FORMAT, fc::mutable_variant_object()__VA_ARGS__ )
167
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
string get_file() const
time_point get_timestamp() const
uint64_t get_line_number() const
string to_string() const
string get_host_name() const
variant to_variant() const
string get_context() const
values
Define's the various log levels for reporting.
string to_string() const
log_level(values v=off)
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.
stores null, int64, uint64, double, bool, string, std::vector<variant>, and variant_object's.
Definition variant.hpp:191
namespace sysio::chain
Definition authority.cpp:3
std::string string
Definition string.hpp:10
std::vector< log_message > log_messages
void from_variant(const fc::variant &v, sysio::chain::chain_id_type &cid)
void to_variant(const sysio::chain::shared_public_key &var, fc::variant &vo)
Definition authority.cpp:4
#define FC_REFLECT_TYPENAME(TYPE)
Definition reflect.hpp:320
unsigned __int64 uint64_t
Definition stdint.h:136
cmd_format format
int l