pub struct LogGuard { /* private fields */ }Expand description
A guard that manages the lifecycle of the logging subsystem.
LogGuard tracks active users of the process-global logging subsystem. Dropping the last guard
synchronously flushes and syncs pending file logs, but leaves the logging thread running so a
later initialization can acquire a valid guard. Only crate::logging::logging_shutdown
permanently terminates the logging thread.
§Reference Counting
The logging system maintains a global atomic counter of active LogGuard instances. This
ensures that:
- The logging thread remains active for the process lifetime, including while no guards exist.
- Pending log messages are flushed when intermediate guards are dropped.
- Pending file logs are synchronously flushed and synced when the last guard is dropped.
§Shutdown Behavior
Call crate::logging::logging_shutdown for terminal shutdown. After shutdown, no new guards
can be acquired and the logger cannot be re-initialized.
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§
impl DerefToPyAny for LogGuard
Source§impl Drop for LogGuard
impl Drop for LogGuard
impl ExtractPyClassWithClone for LogGuard
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` tracks active users of the process-global logging subsystem. Dropping the last guard
/// synchronously flushes and syncs pending file logs, but leaves the logging thread running so a
/// later initialization can acquire a valid guard. Only [`crate::logging::logging_shutdown`]
/// permanently terminates the logging thread.
///
/// # Reference Counting
///
/// The logging system maintains a global atomic counter of active `LogGuard` instances. This
/// ensures that:
/// - The logging thread remains active for the process lifetime, including while no guards exist.
/// - Pending log messages are flushed when intermediate guards are dropped.
/// - Pending file logs are synchronously flushed and synced when the last guard is dropped.
///
/// # Shutdown Behavior
///
/// Call [`crate::logging::logging_shutdown`] for terminal shutdown. After shutdown, no new guards
/// can be acquired and the logger cannot be re-initialized.
///
/// **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` tracks active users of the process-global logging subsystem. Dropping the last guard /// synchronously flushes and syncs pending file logs, but leaves the logging thread running so a /// later initialization can acquire a valid guard. Only [`crate::logging::logging_shutdown`] /// permanently terminates the logging thread. /// /// # Reference Counting /// /// The logging system maintains a global atomic counter of active `LogGuard` instances. This /// ensures that: /// - The logging thread remains active for the process lifetime, including while no guards exist. /// - Pending log messages are flushed when intermediate guards are dropped. /// - Pending file logs are synchronously flushed and synced when the last guard is dropped. /// /// # Shutdown Behavior /// /// Call [`crate::logging::logging_shutdown`] for terminal shutdown. After shutdown, no new guards /// can be acquired and the logger cannot be re-initialized. /// /// **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 Layout = <<LogGuard as PyClassImpl>::BaseNativeType as PyClassBaseType>::Layout<LogGuard>
type Layout = <<LogGuard as PyClassImpl>::BaseNativeType as PyClassBaseType>::Layout<LogGuard>
Source§type ThreadChecker = NoopThreadChecker
type ThreadChecker = NoopThreadChecker
type Inventory = Pyo3MethodsInventoryForLogGuard
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<PyObjectOffset>
fn dict_offset() -> Option<PyObjectOffset>
§fn weaklist_offset() -> Option<PyObjectOffset>
fn weaklist_offset() -> Option<PyObjectOffset>
Source§impl PyStubType for LogGuard
impl PyStubType for LogGuard
Source§fn type_output() -> TypeInfo
fn type_output() -> TypeInfo
§fn type_input() -> TypeInfo
fn type_input() -> TypeInfo
Source§impl PyTypeInfo for LogGuard
impl PyTypeInfo for LogGuard
Source§const NAME: &str = <Self as ::pyo3::PyClass>::NAME
const NAME: &str = <Self as ::pyo3::PyClass>::NAME
prefer using ::type_object(py).name() to get the correct runtime value
Source§const MODULE: Option<&str> = <Self as ::pyo3::impl_::pyclass::PyClassImpl>::MODULE
const MODULE: Option<&str> = <Self as ::pyo3::impl_::pyclass::PyClassImpl>::MODULE
prefer using ::type_object(py).module() to get the correct runtime value
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.Auto Trait Implementations§
impl Freeze for LogGuard
impl RefUnwindSafe for LogGuard
impl Send for LogGuard
impl Sync for LogGuard
impl Unpin for LogGuard
impl UnsafeUnpin for LogGuard
impl UnwindSafe for LogGuard
Blanket Implementations§
impl<T> Allocation for T
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§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§impl<'py, T> IntoPyObjectNautilusExt<'py> for Twhere
T: IntoPyObjectExt<'py>,
impl<'py, T> IntoPyObjectNautilusExt<'py> for Twhere
T: IntoPyObjectExt<'py>,
§fn into_py_any_unwrap(self, py: Python<'py>) -> Py<PyAny>where
Self: IntoPyObject<'py, Error = !>,
fn into_py_any_unwrap(self, py: Python<'py>) -> Py<PyAny>where
Self: IntoPyObject<'py, Error = !>,
self into a [Py<PyAny>] when the underlying conversion is infallible.§impl<T> PyErrArguments for T
impl<T> PyErrArguments for T
§impl<T> PyTypeCheck for Twhere
T: PyTypeInfo,
impl<T> PyTypeCheck for Twhere
T: PyTypeInfo,
§fn type_check(object: &Bound<'_, PyAny>) -> bool
fn type_check(object: &Bound<'_, PyAny>) -> bool
§fn classinfo_object(py: Python<'_>) -> Bound<'_, PyAny>
fn classinfo_object(py: Python<'_>) -> Bound<'_, PyAny>
isinstance and issubclass function. Read more