Thrill  0.1
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() [1/4]

JsonLogger ( )
default

open JsonLogger with ofstream uninitialized to discard log output.

◆ JsonLogger() [2/4]

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() [3/4]

JsonLogger ( JsonLogger super)
explicit

open JsonLogger with a super logger

Definition at line 54 of file json_logger.cpp.

◆ JsonLogger() [4/4]

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

◆ line()

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().

◆ operator<<()

JsonLine operator<< ( const Type &  t)
inline

Definition at line 431 of file json_logger.hpp.

References JsonLogger::line().

◆ StartProfiler()

void StartProfiler ( )

launch background profiler

Member Data Documentation

◆ common_

JsonVerbatim common_

common items outputted to each line

Definition at line 106 of file json_logger.hpp.

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

◆ mutex_

std::mutex mutex_

mutex to lock logger output

Definition at line 103 of file json_logger.hpp.

◆ os_

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().

◆ super_

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: