coastline 0.0.4
Loading...
Searching...
No Matches
coastline::GameLog Class Reference

Forward SDL messages to a file and the previous callback until destruction. More...

#include <log.h>

Public Member Functions

 GameLog (const std::filesystem::path &path)
 Open path, truncating an existing log.
 ~GameLog ()
 Close the log file and restore the SDL callback active before construction.
 GameLog (const GameLog &)=delete
 Copying is disabled because this log registers a callback tied to its lifetime.
GameLog & operator= (const GameLog &)=delete
 Assignment is disabled because callback restoration follows construction order.
bool IsOpen () const

Friends

void StopGameLog ()
 Close the active game log and restore its previous callback before fatal process exit.

Detailed Description

Forward SDL messages to a file and the previous callback until destruction.

Destroy nested instances in reverse construction order to restore callbacks correctly.

Constructor & Destructor Documentation

◆ GameLog() [1/2]

coastline::GameLog::GameLog ( const std::filesystem::path & path)
explicit

Open path, truncating an existing log.

SDL messages still go to the previous callback when the file cannot be opened.

Parameters
pathThe log file to create or truncate.

◆ ~GameLog()

coastline::GameLog::~GameLog ( )

Close the log file and restore the SDL callback active before construction.

◆ GameLog() [2/2]

coastline::GameLog::GameLog ( const GameLog & )
delete

Copying is disabled because this log registers a callback tied to its lifetime.

Member Function Documentation

◆ operator=()

GameLog & coastline::GameLog::operator= ( const GameLog & )
delete

Assignment is disabled because callback restoration follows construction order.

◆ IsOpen()

bool coastline::GameLog::IsOpen ( ) const
Returns
Whether the log file is open.

◆ StopGameLog

void StopGameLog ( )
friend

Close the active game log and restore its previous callback before fatal process exit.


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