Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
Logging::Log Class Reference

#include <system_utils.h>

Public Types

using Manip = std::ostream &(*)(std::ostream &)
 

Public Member Functions

 Log ()
 
bool Init (const std::string &filename="olympe.log")
 
void Shutdown ()
 
void SetOutputs (unsigned flags)
 
unsigned GetOutputs () const
 
template<typename T >
auto operator<< (const T &v) -> decltype(std::declval< std::ostringstream & >()<< v, std::declval< Log & >())
 
Logoperator<< (Manip m)
 

Private Member Functions

void writeToOutputs (const std::string &s)
 
void flushCompleteLinesIfAny ()
 
void flushRemaining ()
 

Private Attributes

std::mutex m_
 
std::ostringstream buffer_
 
unsigned outputs_
 
std::ofstream file_
 
bool file_open_
 

Detailed Description

Definition at line 37 of file system_utils.h.

Member Typedef Documentation

◆ Manip

using Logging::Log::Manip = std::ostream& (*)(std::ostream&)

Definition at line 81 of file system_utils.h.

Constructor & Destructor Documentation

◆ Log()

Logging::Log::Log ( )
inline

Definition at line 40 of file system_utils.h.

Member Function Documentation

◆ flushCompleteLinesIfAny()

void Logging::Log::flushCompleteLinesIfAny ( )
inlineprivate

Definition at line 129 of file system_utils.h.

References buffer_, GetComponentTypeID_Static(), m_, and writeToOutputs().

Referenced by operator<<(), and operator<<().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ flushRemaining()

void Logging::Log::flushRemaining ( )
inlineprivate

Definition at line 144 of file system_utils.h.

References buffer_, GetComponentTypeID_Static(), m_, and writeToOutputs().

Referenced by operator<<().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetOutputs()

unsigned Logging::Log::GetOutputs ( ) const
inline

Definition at line 66 of file system_utils.h.

References outputs_.

◆ Init()

bool Logging::Log::Init ( const std::string &  filename = "olympe.log")
inline

Definition at line 43 of file system_utils.h.

References file_, file_open_, GetComponentTypeID_Static(), and m_.

Referenced by Logging::InitLogger().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator<<() [1/2]

template<typename T >
auto Logging::Log::operator<< ( const T v) -> decltype(std::declval<std::ostringstream&>() << v, std::declval<Log&>())
inline

Definition at line 70 of file system_utils.h.

References buffer_, flushCompleteLinesIfAny(), GetComponentTypeID_Static(), and m_.

+ Here is the call graph for this function:

◆ operator<<() [2/2]

Log & Logging::Log::operator<< ( Manip  m)
inline

Definition at line 82 of file system_utils.h.

References buffer_, flushCompleteLinesIfAny(), flushRemaining(), GetComponentTypeID_Static(), and m_.

+ Here is the call graph for this function:

◆ SetOutputs()

void Logging::Log::SetOutputs ( unsigned  flags)
inline

Definition at line 60 of file system_utils.h.

References GetComponentTypeID_Static(), m_, and outputs_.

+ Here is the call graph for this function:

◆ Shutdown()

void Logging::Log::Shutdown ( )
inline

Definition at line 53 of file system_utils.h.

References file_, file_open_, GetComponentTypeID_Static(), and m_.

Referenced by Logging::ShutdownLogger().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writeToOutputs()

void Logging::Log::writeToOutputs ( const std::string &  s)
inlineprivate

Definition at line 108 of file system_utils.h.

References SystemLogSink::AppendToLogWindow(), file_, file_open_, GetComponentTypeID_Static(), Logging::Out_Cout, Logging::Out_File, Logging::Out_Panel, and outputs_.

Referenced by flushCompleteLinesIfAny(), and flushRemaining().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ buffer_

std::ostringstream Logging::Log::buffer_
private

Definition at line 157 of file system_utils.h.

Referenced by flushCompleteLinesIfAny(), flushRemaining(), operator<<(), and operator<<().

◆ file_

std::ofstream Logging::Log::file_
private

Definition at line 159 of file system_utils.h.

Referenced by Init(), Shutdown(), and writeToOutputs().

◆ file_open_

bool Logging::Log::file_open_
private

Definition at line 160 of file system_utils.h.

Referenced by Init(), Shutdown(), and writeToOutputs().

◆ m_

std::mutex Logging::Log::m_
mutableprivate

◆ outputs_

unsigned Logging::Log::outputs_
private

Definition at line 158 of file system_utils.h.

Referenced by GetOutputs(), SetOutputs(), and writeToOutputs().


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