コード例 #1
0
ファイル: etest.c プロジェクト: knaka/src
int
main (
  int argc,
  char * * argv ) {
  int i;
    init_exception_handler(argv[0]);
    for (i = -3; i < 3; i ++) {
      int e;
        try {
            foo(i);
            throw(UnknownException);
        } catch (e) {
            e_getMessage(e, __func__);
            printStackTrace();
        }
    }
    return (0);
}
コード例 #2
0
void init()
{
    typedef sinks::synchronous_sink< sinks::text_ostream_backend > text_sink;
    boost::shared_ptr< text_sink > pSink = boost::make_shared< text_sink >();

    pSink->locked_backend()->add_stream(
        boost::make_shared< std::ofstream >("sample.log"));

    pSink->set_formatter
    (
        fmt::stream
            << fmt::attr< unsigned int >("LineID")
            << ": <" << fmt::attr< severity_level >("Severity")
            << "> " << fmt::message()
    );

    logging::core::get()->add_sink(pSink);

    init_exception_handler();
}