pub struct LogFacade { /* private fields */ }Expand description
日志 facade — 持有默认 StructuredLogger 和命名通道
对齐 PHP think\facade\Log,提供全局日志访问点。
Implementations§
Source§impl LogFacade
impl LogFacade
Sourcepub fn new(section: &LogSection) -> LogFacade
pub fn new(section: &LogSection) -> LogFacade
构造 LogFacade 实例(不注册到全局单例)
Sourcepub fn init(section: &LogSection) -> &'static LogFacade
pub fn init(section: &LogSection) -> &'static LogFacade
初始化全局日志 facade
重复调用返回已有实例(不覆盖)。
Sourcepub fn instance() -> Option<&'static LogFacade>
pub fn instance() -> Option<&'static LogFacade>
获取全局日志 facade 实例
必须先调用 LogFacade::init() 初始化,否则返回 None。
Sourcepub fn default_channel(&self) -> &str
pub fn default_channel(&self) -> &str
获取默认通道名
Sourcepub fn logger(&self) -> &StructuredLogger
pub fn logger(&self) -> &StructuredLogger
获取默认 logger 引用
Sourcepub fn channel(&self, name: &str) -> Option<ChannelRef<'_>>
pub fn channel(&self, name: &str) -> Option<ChannelRef<'_>>
获取指定通道的 logger 引用
对齐 PHP Log::channel('file')->info(...)。
Sourcepub fn channel_names(&self) -> Vec<String>
pub fn channel_names(&self) -> Vec<String>
获取所有通道名
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for LogFacade
impl !RefUnwindSafe for LogFacade
impl !UnwindSafe for LogFacade
impl Send for LogFacade
impl Sync for LogFacade
impl Unpin for LogFacade
impl UnsafeUnpin for LogFacade
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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> ⓘ
Converts
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> ⓘ
Converts
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.