Thrill  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
JsonLogger Class Reference

Detailed Description

JsonLogger is a receiver of JSON output objects for logging.

Definition at line 69 of file json_logger.hpp.

+ Collaboration diagram for JsonLogger:

#include <json_logger.hpp>

Public Member Functions

 JsonLogger ()=default
 open JsonLogger with ofstream uninitialized to discard log output. More...
 
 JsonLogger (const std::string &path)
 open JsonLogger with ofstream. if path is empty, output goes to stdout More...
 
 JsonLogger (JsonLogger *super)
 open JsonLogger with a super logger More...
 
template<typename... Args>
 JsonLogger (JsonLogger *super, const Args &...args)
 
JsonLine line ()
 create new JsonLine instance which will be written to this logger. More...
 
template<typename Type >
JsonLine operator<< (const Type &t)
 
void StartProfiler ()
 launch background profiler More...
 

Public Attributes

JsonVerbatim common_
 common items outputted to each line More...
 
std::mutex mutex_
 mutex to lock logger output More...
 
std::unique_ptr< std::ostream > os_
 direct output stream for top loggers More...
 
JsonLoggersuper_ = nullptr
 output to superior JsonLogger More...
 

Constructor & Destructor Documentation

JsonLogger ( )
default

open JsonLogger with ofstream uninitialized to discard log output.

JsonLogger ( const std::string &  path)
explicit

open JsonLogger with ofstream. if path is empty, output goes to stdout

Definition at line 33 of file json_logger.cpp.

References die, and JsonLogger::os_.

JsonLogger ( JsonLogger super)
explicit

open JsonLogger with a super logger

Definition at line 54 of file json_logger.cpp.

JsonLogger ( JsonLogger super,
const Args &...  args 
)
explicit

open JsonLogger with a super logger and some additional common key:value pairs

Definition at line 416 of file json_logger.hpp.

References tlx::call_foreach(), and JsonLogger::common_.

Member Function Documentation

JsonLine line ( )

create new JsonLine instance which will be written to this logger.

Definition at line 57 of file json_logger.cpp.

References JsonLogger::common_, JsonLogger::JsonLine, JsonLogger::line(), JsonLogger::os_, JsonVerbatim::str_, and JsonLogger::super_.

Referenced by JsonLogger::line(), JsonLogger::operator<<(), and Manager::RunTask().

JsonLine operator<< ( const Type &  t)
inline

Definition at line 431 of file json_logger.hpp.

References JsonLogger::line().

void StartProfiler ( )

launch background profiler

Member Data Documentation

JsonVerbatim common_

common items outputted to each line

Definition at line 106 of file json_logger.hpp.

Referenced by JsonLogger::JsonLogger(), and JsonLogger::line().

std::mutex mutex_

mutex to lock logger output

Definition at line 103 of file json_logger.hpp.

Referenced by JsonLine::JsonLine().

std::unique_ptr<std::ostream> os_

direct output stream for top loggers

Definition at line 100 of file json_logger.hpp.

Referenced by JsonLogger::JsonLogger(), and JsonLogger::line().

JsonLogger* super_ = nullptr

output to superior JsonLogger

Definition at line 97 of file json_logger.hpp.

Referenced by JsonLogger::line().


The documentation for this class was generated from the following files: