RunicVTT Open Source Virtual Tabletop for TTRPG using P2P
Loading...
Searching...
No Matches
Logger::OstreamRedirect Class Reference
Collaboration diagram for Logger::OstreamRedirect:

Public Member Functions

 OstreamRedirect (std::ostream &os, const std::string &channel, std::optional< Level > forced=std::nullopt)
 
 ~OstreamRedirect ()
 
 OstreamRedirect (const OstreamRedirect &)=delete
 
OstreamRedirectoperator= (const OstreamRedirect &)=delete
 
 OstreamRedirect (OstreamRedirect &&)=delete
 
OstreamRedirectoperator= (OstreamRedirect &&)=delete
 

Private Attributes

std::ostream & os_
 
std::streambuf * original_
 
LineToLoggerBuf buf_
 

Detailed Description

Definition at line 217 of file Logger.h.

Constructor & Destructor Documentation

◆ OstreamRedirect() [1/3]

Logger::OstreamRedirect::OstreamRedirect ( std::ostream & os,
const std::string & channel,
std::optional< Level > forced = std::nullopt )
inline

Definition at line 221 of file Logger.h.

221 :
222 os_(os), original_(os.rdbuf()), buf_(channel, forced)
223 {
224 os_.rdbuf(&buf_);
225 }
std::streambuf * original_
Definition Logger.h:247
LineToLoggerBuf buf_
Definition Logger.h:248
std::ostream & os_
Definition Logger.h:246

◆ ~OstreamRedirect()

Logger::OstreamRedirect::~OstreamRedirect ( )
inline

Definition at line 226 of file Logger.h.

227 {
228 if (original_)
229 {
230 try
231 {
232 os_.rdbuf(original_);
233 }
234 catch (...)
235 {
236 }
237 }
238 }

◆ OstreamRedirect() [2/3]

Logger::OstreamRedirect::OstreamRedirect ( const OstreamRedirect & )
delete

◆ OstreamRedirect() [3/3]

Logger::OstreamRedirect::OstreamRedirect ( OstreamRedirect && )
delete

Member Function Documentation

◆ operator=() [1/2]

OstreamRedirect & Logger::OstreamRedirect::operator= ( const OstreamRedirect & )
delete

◆ operator=() [2/2]

OstreamRedirect & Logger::OstreamRedirect::operator= ( OstreamRedirect && )
delete

Member Data Documentation

◆ buf_

LineToLoggerBuf Logger::OstreamRedirect::buf_
private

Definition at line 248 of file Logger.h.

◆ original_

std::streambuf* Logger::OstreamRedirect::original_
private

Definition at line 247 of file Logger.h.

◆ os_

std::ostream& Logger::OstreamRedirect::os_
private

Definition at line 246 of file Logger.h.


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