The Battle for Wesnoth  1.19.5+dev
Public Member Functions | Private Attributes | List of all members
lg::redirect_output_setter Class Reference

Helper class to redirect the output of the logger in a certain scope. More...

#include <log.hpp>

Public Member Functions

 redirect_output_setter (std::ostream &stream)
 Constructor. More...
 
 ~redirect_output_setter ()
 

Private Attributes

std::ostream * old_stream_
 The previously set redirection. More...
 

Detailed Description

Helper class to redirect the output of the logger in a certain scope.

The main usage of the redirection is for the unit tests to validate the output on the logger with the expected output.

Definition at line 98 of file log.hpp.

Constructor & Destructor Documentation

◆ redirect_output_setter()

lg::redirect_output_setter::redirect_output_setter ( std::ostream &  stream)
explicit

Constructor.

Parameters
streamThe stream to direct the output to.

Definition at line 290 of file log.cpp.

References output_stream_.

◆ ~redirect_output_setter()

lg::redirect_output_setter::~redirect_output_setter ( )

Definition at line 296 of file log.cpp.

References old_stream_, and output_stream_.

Member Data Documentation

◆ old_stream_

std::ostream* lg::redirect_output_setter::old_stream_
private

The previously set redirection.

This value is stored here to be restored in this destructor.

Definition at line 118 of file log.hpp.

Referenced by ~redirect_output_setter().


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