pub struct LogGuard { /* private fields */ }
Expand description
A guard that manages the lifecycle of the logging subsystem.
LogGuard
ensures the logging thread remains active while instances exist and properly
terminates when all guards are dropped. The system uses reference counting to track active
guards - when the last LogGuard
is dropped, the logging thread is joined to ensure all
pending log messages are written before the process terminates.
§Reference Counting
The logging system maintains a global atomic counter of active LogGuard
instances. This
ensures that:
- The logging thread remains active as long as at least one
LogGuard
exists. - All log messages are properly flushed when intermediate guards are dropped.
- The logging thread is cleanly terminated and joined when the last guard is dropped.
§Shutdown Behavior
When the last guard is dropped, the logging thread is signaled to close, drains pending messages, and is joined to ensure all logs are written before process termination.
Python on Windows: Non-deterministic GC order during interpreter shutdown can occasionally prevent proper thread join, resulting in truncated logs.
§Limits
The system supports a maximum of 255 concurrent LogGuard
instances.
Implementations§
Trait Implementations§
Source§impl<'py> IntoPyObject<'py> for LogGuard
impl<'py> IntoPyObject<'py> for LogGuard
Source§impl PyClassImpl for LogGuard
impl PyClassImpl for LogGuard
Source§const IS_BASETYPE: bool = false
const IS_BASETYPE: bool = false
Source§const IS_SUBCLASS: bool = false
const IS_SUBCLASS: bool = false
Source§const IS_MAPPING: bool = false
const IS_MAPPING: bool = false
Source§const IS_SEQUENCE: bool = false
const IS_SEQUENCE: bool = false
Source§const IS_IMMUTABLE_TYPE: bool = false
const IS_IMMUTABLE_TYPE: bool = false
Source§const RAW_DOC: &'static CStr = /// A guard that manages the lifecycle of the logging subsystem.
///
/// `LogGuard` ensures the logging thread remains active while instances exist and properly
/// terminates when all guards are dropped. The system uses reference counting to track active
/// guards - when the last `LogGuard` is dropped, the logging thread is joined to ensure all
/// pending log messages are written before the process terminates.
///
/// # Reference Counting
///
/// The logging system maintains a global atomic counter of active `LogGuard` instances. This
/// ensures that:
/// - The logging thread remains active as long as at least one `LogGuard` exists.
/// - All log messages are properly flushed when intermediate guards are dropped.
/// - The logging thread is cleanly terminated and joined when the last guard is dropped.
///
/// # Shutdown Behavior
///
/// When the last guard is dropped, the logging thread is signaled to close, drains pending
/// messages, and is joined to ensure all logs are written before process termination.
///
/// **Python on Windows:** Non-deterministic GC order during interpreter shutdown can
/// occasionally prevent proper thread join, resulting in truncated logs.
///
/// # Limits
///
/// The system supports a maximum of 255 concurrent `LogGuard` instances.
const RAW_DOC: &'static CStr = /// A guard that manages the lifecycle of the logging subsystem. /// /// `LogGuard` ensures the logging thread remains active while instances exist and properly /// terminates when all guards are dropped. The system uses reference counting to track active /// guards - when the last `LogGuard` is dropped, the logging thread is joined to ensure all /// pending log messages are written before the process terminates. /// /// # Reference Counting /// /// The logging system maintains a global atomic counter of active `LogGuard` instances. This /// ensures that: /// - The logging thread remains active as long as at least one `LogGuard` exists. /// - All log messages are properly flushed when intermediate guards are dropped. /// - The logging thread is cleanly terminated and joined when the last guard is dropped. /// /// # Shutdown Behavior /// /// When the last guard is dropped, the logging thread is signaled to close, drains pending /// messages, and is joined to ensure all logs are written before process termination. /// /// **Python on Windows:** Non-deterministic GC order during interpreter shutdown can /// occasionally prevent proper thread join, resulting in truncated logs. /// /// # Limits /// /// The system supports a maximum of 255 concurrent `LogGuard` instances.
Source§const DOC: &'static CStr
const DOC: &'static CStr
text_signature
if a constructor is defined. Read moreSource§type ThreadChecker = SendablePyClass<LogGuard>
type ThreadChecker = SendablePyClass<LogGuard>
Source§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
Source§type BaseNativeType = PyAny
type BaseNativeType = PyAny
PyAny
by default, and when you declare
#[pyclass(extends=PyDict)]
, it’s PyDict
.fn items_iter() -> PyClassItemsIter
fn lazy_type_object() -> &'static LazyTypeObject<Self>
fn dict_offset() -> Option<isize>
fn weaklist_offset() -> Option<isize>
Source§impl PyTypeInfo for LogGuard
impl PyTypeInfo for LogGuard
Source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
§fn type_object(py: Python<'_>) -> Bound<'_, PyType>
fn type_object(py: Python<'_>) -> Bound<'_, PyType>
§fn is_type_of(object: &Bound<'_, PyAny>) -> bool
fn is_type_of(object: &Bound<'_, PyAny>) -> bool
object
is an instance of this type or a subclass of this type.§fn is_exact_type_of(object: &Bound<'_, PyAny>) -> bool
fn is_exact_type_of(object: &Bound<'_, PyAny>) -> bool
object
is an instance of this type.impl DerefToPyAny for LogGuard
Auto Trait Implementations§
impl Freeze for LogGuard
impl RefUnwindSafe for LogGuard
impl Send for LogGuard
impl Sync for LogGuard
impl Unpin for LogGuard
impl UnwindSafe for LogGuard
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more§impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
§fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
self
into an owned Python object, dropping type information.§fn into_py_any(self, py: Python<'py>) -> Result<Py<PyAny>, PyErr>
fn into_py_any(self, py: Python<'py>) -> Result<Py<PyAny>, PyErr>
self
into an owned Python object, dropping type information and unbinding it
from the 'py
lifetime.§fn into_pyobject_or_pyerr(self, py: Python<'py>) -> Result<Self::Output, PyErr>
fn into_pyobject_or_pyerr(self, py: Python<'py>) -> Result<Self::Output, PyErr>
self
into a Python object. Read more