Aspen
2D C++ Class-Based Object Oriented Game Engine
Aspen::Log::Log Class Reference

Log functor class Used for logging information to the console. More...

#include <Log.hpp>

Public Member Functions

 Log (std::string prefix="", std::string suffix="", bool print=true)
 Constructor. More...
 
void operator() (const char *format,...)
 Log request Functions similarly to printf. More...
 
void operator() (const std::stringstream &message)
 Log request. More...
 
void TogglePrint ()
 Toggles _print.
 

Static Public Member Functions

static bool SetFile (std::string path)
 sets the current logfile More...
 

Private Attributes

std::string _pre
 Prefix used when logging.
 
std::string _suf
 Suffix used when logging.
 
bool _print
 Determines if calls to operator() are completed.
 

Static Private Attributes

static int _line
 Current line number.
 
static std::fstream _file
 Output filestream shared across all Log classes.
 

Detailed Description

Log functor class Used for logging information to the console.

Constructor & Destructor Documentation

◆ Log()

Aspen::Log::Log::Log ( std::string  prefix = "",
std::string  suffix = "",
bool  print = true 
)

Constructor.

Parameters
prefixPrefix used when logging
suffixSuffix used when logging
printDetermines if calls to operator() are completed

Member Function Documentation

◆ operator()() [1/2]

void Aspen::Log::Log::operator() ( const char *  format,
  ... 
)

Log request Functions similarly to printf.

Parameters
formatFormat string to be passed to vsprintf

◆ operator()() [2/2]

void Aspen::Log::Log::operator() ( const std::stringstream &  message)
inline

Log request.

Parameters
messageMessage to be unwrapped as a string

◆ SetFile()

static bool Aspen::Log::Log::SetFile ( std::string  path)
static

sets the current logfile

Parameters
pathOutput filepath
Returns
Success of opening the output file

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