Updates from BitShares FC #22

Closed
nathanielhourt wants to merge 693 commits from dapp-support into latest-fc
7 changed files with 14 additions and 13 deletions
Showing only changes of commit 2f5f599e0d - Show all commits

View file

@ -2,3 +2,8 @@
// The maximum level of object nesting is around 20% of this value
#define FC_PACK_MAX_DEPTH 1000
#endif
#ifndef FC_MAX_LOG_OBJECT_DEPTH
// how many levels of nested objects are displayed in log messages
#define FC_MAX_LOG_OBJECT_DEPTH 200
#endif

View file

@ -38,7 +38,7 @@ namespace fc
{
config()
:format( "${timestamp} ${thread_name} ${context} ${file}:${line} ${method} ${level}] ${message}" ),
stream(console_appender::stream::std_error),max_object_depth(LOG_MAX_OBJECT_DEPTH),flush(true){}
stream(console_appender::stream::std_error),max_object_depth(FC_MAX_LOG_OBJECT_DEPTH),flush(true){}
fc::string format;
console_appender::stream::type stream;

View file

@ -3,6 +3,7 @@
* @file log_message.hpp
* @brief Defines types and helper macros necessary for generating log messages.
*/
#include <fc/config.hpp>
#include <fc/time.hpp>
#include <fc/variant_object.hpp>
#include <fc/shared_ptr.hpp>
@ -139,8 +140,6 @@ FC_REFLECT_TYPENAME( fc::log_message );
#define __func__ __FUNCTION__
#endif
#define LOG_MAX_OBJECT_DEPTH 210
/**
* @def FC_LOG_CONTEXT(LOG_LEVEL)
* @brief Automatically captures the File, Line, and Method names and passes them to
@ -160,5 +159,5 @@ FC_REFLECT_TYPENAME( fc::log_message );
* @param ... A set of key/value pairs denoted as ("key",val)("key2",val2)...
*/
#define FC_LOG_MESSAGE( LOG_LEVEL, FORMAT, ... ) \
fc::log_message( FC_LOG_CONTEXT(LOG_LEVEL), FORMAT, fc::limited_mutable_variant_object(LOG_MAX_OBJECT_DEPTH)__VA_ARGS__ )
fc::log_message( FC_LOG_CONTEXT(LOG_LEVEL), FORMAT, fc::limited_mutable_variant_object(FC_MAX_LOG_OBJECT_DEPTH)__VA_ARGS__ )

View file

@ -1,4 +1,5 @@
#pragma once
#include <fc/config.hpp>
#include <fc/string.hpp>
#include <fc/time.hpp>
#include <fc/shared_ptr.hpp>
@ -145,7 +146,7 @@ namespace fc
BOOST_PP_STRINGIZE(base) ": ${" BOOST_PP_STRINGIZE( base ) "} "
#define FC_FORMAT_ARGS(r, unused, base) \
BOOST_PP_LPAREN() BOOST_PP_STRINGIZE(base),fc::variant(base,LOG_MAX_OBJECT_DEPTH) BOOST_PP_RPAREN()
BOOST_PP_LPAREN() BOOST_PP_STRINGIZE(base),fc::variant(base,FC_MAX_LOG_OBJECT_DEPTH) BOOST_PP_RPAREN()
#define FC_FORMAT( SEQ )\
BOOST_PP_SEQ_FOR_EACH( FC_FORMAT_ARG, v, SEQ )

View file

@ -31,7 +31,7 @@ namespace fc {
console_appender::console_appender( const variant& args )
:my(new impl)
{
configure( args.as<config>(LOG_MAX_OBJECT_DEPTH) );
configure( args.as<config>( FC_MAX_LOG_OBJECT_DEPTH ) );
}
console_appender::console_appender( const config& cfg )
@ -138,7 +138,7 @@ namespace fc {
#endif
if( text.size() )
fprintf( out, "%s", text.c_str() ); //fmt_str.c_str() );
fprintf( out, "%s", text.c_str() );
#ifdef WIN32
if (my->console_handle != INVALID_HANDLE_VALUE)

View file

@ -138,7 +138,7 @@ namespace fc {
{}
file_appender::file_appender( const variant& args ) :
my( new impl( args.as<config>(LOG_MAX_OBJECT_DEPTH) ) )
my( new impl( args.as<config>( FC_MAX_LOG_OBJECT_DEPTH ) ) )
{
try
{
@ -183,10 +183,6 @@ namespace fc {
fc::string message = fc::format_string( m.get_format(), m.get_data(), my->cfg.max_object_depth );
line << message.c_str();
//fc::variant lmsg(m);
// fc::string fmt_str = fc::format_string( my->cfg.format, mutable_variant_object(m.get_context())( "message", message) );
{
fc::scoped_lock<boost::mutex> lock( my->slock );
my->out << line.str() << "\t\t\t" << m.get_context().get_file() << ":" << m.get_context().get_line_number() << "\n";

View file

@ -38,7 +38,7 @@ namespace fc
};
gelf_appender::gelf_appender(const variant& args) :
my(new impl(args.as<config>(LOG_MAX_OBJECT_DEPTH)))
my( new impl( args.as<config>( FC_MAX_LOG_OBJECT_DEPTH ) ) )
{
try
{