sculpto
Public Member Functions | List of all members
scl::logger Class Reference

#include <logger.h>

Public Member Functions

 logger (const std::string &Name="")
 
template<typename... Targs>
void Info (std::string_view Format, Targs &&... Args) const
 
template<typename... Targs>
void Success (std::string_view Format, Targs &&... Args) const
 
template<typename... Targs>
void Warn (std::string_view Format, Targs &&... Args) const
 
template<typename... Targs>
void Error (std::string_view Format, Targs &&... Args) const
 
void SetStream (std::ostream OutStream)
 

Detailed Description

Logger class.

Definition at line 19 of file logger.h.

Constructor & Destructor Documentation

◆ logger()

scl::logger::logger ( const std::string &  Name = "")
  • Logger default constructor.
Parameters
Name- name of logger to be displayed at records.

Definition at line 12 of file logger.cpp.

12 :
13 Name(Name) {}

Member Function Documentation

◆ Error()

template<typename... Targs>
void scl::logger::Error ( std::string_view  Format,
Targs &&...  Args 
) const
inline
  • Log error message to current out stream.
Parameters
Message- message to log.
Returns
None.

Definition at line 90 of file logger.h.

91 {
92 Out <<
93 "[" << CurrentTime() << "] {|" << Name << "|} " <<
95 std::vformat(Format, std::make_format_args(Args...)) <<
97 }
const std::string color_literal_reset()
std::string color_literal(color ForegroundColor)
const std::string CurrentTime()
Definition: current_time.h:19

◆ Info()

template<typename... Targs>
void scl::logger::Info ( std::string_view  Format,
Targs &&...  Args 
) const
inline

Events logging methods.

  • Log info message to current out stream.
Parameters
Message- message to log.
Returns
None.

Definition at line 43 of file logger.h.

44 {
45 Out <<
46 "[" << CurrentTime() << "] {|" << Name << "|} " <<
47 std::vformat(Format, std::make_format_args(Args...)) <<
48 '\n';
49 }

◆ SetStream()

void scl::logger::SetStream ( std::ostream  OutStream)
  • Set currently using out stream.
Parameters
OutStream- new stream to log in.
Returns
None.

Definition at line 15 of file logger.cpp.

16{
17}

◆ Success()

template<typename... Targs>
void scl::logger::Success ( std::string_view  Format,
Targs &&...  Args 
) const
inline
  • Log success message to current out stream.
Parameters
Message- message to log.
Returns
None.

Definition at line 58 of file logger.h.

59 {
60 Out <<
61 "[" << CurrentTime() << "] {|" << Name << "|} " <<
63 std::vformat(Format, std::make_format_args(Args...)) <<
65 }

◆ Warn()

template<typename... Targs>
void scl::logger::Warn ( std::string_view  Format,
Targs &&...  Args 
) const
inline
  • Log warn message to current out stream.
Parameters
Message- message to log.
Returns
None.

Definition at line 74 of file logger.h.

75 {
76 Out <<
77 "[" << CurrentTime() << "] {|" << Name << "|} " <<
79 std::vformat(Format, std::make_format_args(Args...)) <<
81 }

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