Changeset 176 in pacpusframework for trunk/src/PacpusLib/Log.cpp


Ignore:
Timestamp:
Oct 11, 2013, 2:10:06 PM (11 years ago)
Author:
Marek Kurdej
Message:

Added: addParameters() method in ComponentBase using Boost.Program_Options.
Each component can declare its parameters and they will be read automatically before configureComponent() method.
See example ProducerConsumerExample constructors.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/PacpusLib/Log.cpp

    r146 r176  
    7171   
    7272    logging::add_common_attributes();
     73    logging::core::get()->add_global_attribute(
     74        "ProcessID",
     75        attrs::current_process_id());
     76    logging::core::get()->add_global_attribute(
     77        "ThreadID",
     78        attrs::current_thread_id());
     79
    7380    logging::core::get()->set_filter
    7481    (
     
    93100            expr::stream
    94101                << std::setfill('0') << std::setw(6) << expr::attr< unsigned int >("LineID")
    95                 //<< " [" << expr::format_date_time< posix_time::ptime >("TimeStamp", date_time::iso_extended_format) << "] "
    96                 << " [" << expr::format_date_time< posix_time::ptime >("TimeStamp", "%Y-%m-%d %T.%f") << "] "
    97                 << "<" << logging::trivial::severity << ">"
    98                 << " "
    99                 << expr::smessage
     102                //<< " [" << expr::format_date_time< posix_time::ptime >("TimeStamp", date_time::iso_extended_format) << "]"
     103                << " [" << expr::format_date_time< posix_time::ptime >("TimeStamp", "%Y-%m-%d %T.%f") << "]"
     104                << " <" << logging::trivial::severity << ">"
     105                << " <" << expr::attr< attrs::current_process_id::value_type >("ProcessID")
     106                << ":" << expr::attr< attrs::current_thread_id::value_type >("ThreadID") << ">"
     107                << " " << expr::smessage
    100108        )
    101109    );
Note: See TracChangeset for help on using the changeset viewer.