로딩중...
검색중...
일치하는것 없음
by::enablesZone 클래스 참조

Temporary scope-based enable/disable zone for logging streams 더 자세히 ...

#include <enablesZone.hpp>

Public 멤버 함수

 enablesZone (nbool newVal)
 Constructs an enablesZone and immediately sets all logging streams to the specified enable state, without capturing their previous states.
 
const enables & getPrev () const
 
me & setPrev ()
 Captures the current enable states of all streams as the new "previous" state. This state will be restored when the enablesZone object is destroyed.
 
me & rel ()
 Manually releases the enablesZone, preventing restoration of stream states on destruction.
 
me & setEnable (nbool newVal)
 Sets the enable state for all streams managed by the logger.
 
me & setEnable (const std::string &streamName, nbool newVal)
 Sets the enable state for a specific named stream.
 

상세한 설명

Temporary scope-based enable/disable zone for logging streams

The logger class has multiple stream objects, and you can control output destinations by enabling or disabling specific streams. However, it's very common to need to control streams only within a specific code block or function, then restore the original state when leaving that block.

enablesZone is designed for this use case. Implemented using the RAII idiom, it records the enable state of streams upon object creation, then restores each stream's enable status to its initial state when the enablesZone is destroyed.

Usage

Typical usage pattern:

// Assume all streams in logger are enabled
{
logger& log = logger::get();
log.getStream(0).setEnable(false); // Disable stream 0
logger::getStream("consoleStream").setEnable(false); // Disable console logging
BY_E("error message1"); // This log won't go to stream 0 or console
logger::setEnable(false); // Disable all streams
BY_E("this message won't log on any stream");
}
BY_E("this message will definitely be log on entire stream"); // Back to normal
Temporary scope-based enable/disable zone for logging streams
Definition enablesZone.hpp:39
Main logging interface for the byeol language system
Definition logger.hpp:79
static logger & get()
Get singleton logger instance
#define BY_E(fmt,...)
Log macro: prints debug log on console and file.
Definition macro.hpp:22
Rich logging support with polymorphic type conversion
Definition richLog.hpp:34

생성자 & 소멸자 문서화

◆ enablesZone()

by::enablesZone::enablesZone ( nbool newVal)

Constructs an enablesZone and immediately sets all logging streams to the specified enable state, without capturing their previous states.

매개변수
newValThe new enable state for all streams (true for enabled, false for disabled).

멤버 함수 문서화

◆ rel()

me & by::enablesZone::rel ( )

Manually releases the enablesZone, preventing restoration of stream states on destruction.

반환값
A reference to this enablesZone instance.

◆ setEnable() [1/2]

me & by::enablesZone::setEnable ( const std::string & streamName,
nbool newVal )

Sets the enable state for a specific named stream.

매개변수
streamNameThe name of the stream to modify.
newValThe new enable state (true for enabled, false for disabled).
반환값
A reference to this enablesZone instance.

◆ setEnable() [2/2]

me & by::enablesZone::setEnable ( nbool newVal)

Sets the enable state for all streams managed by the logger.

매개변수
newValThe new enable state (true for enabled, false for disabled).
반환값
A reference to this enablesZone instance.

◆ setPrev()

me & by::enablesZone::setPrev ( )

Captures the current enable states of all streams as the new "previous" state. This state will be restored when the enablesZone object is destroyed.

반환값
A reference to this enablesZone instance.

이 클래스에 대한 문서화 페이지는 다음의 파일로부터 생성되었습니다.: