Skip to main content

LogPlugin

Struct LogPlugin 

Source
pub struct LogPlugin { /* private fields */ }
Expand description

内置日志插件:注册名 “log”,只订阅 EVENT_LOG,deps 为空。

Implementations§

Source§

impl LogPlugin

Source

pub fn console() -> Self

Source

pub fn with_sink(sink: impl Fn(&LogData) + Send + Sync + 'static) -> Self

Source

pub fn set_sink(&self, sink: LogSink)

Trait Implementations§

Source§

impl Plugin for LogPlugin

Source§

fn name(&self) -> &str

注册键(D2 校验)。
Source§

fn routes(&self) -> Vec<Cow<'static, str>>

订阅的 type 集合:广播 type(如业务常量 “eTick.”)、 自身的寻址 type(e_req_type(本名)/e_to_type(本名))。 宿主 start() 装配 forwarder → 邮箱 → on_mail。
Source§

fn on_mail(&self, event: &Event)

★ 唯一业务入口:永远在本插件 worker 线程上串行执行。 广播事件、寻址请求(eReq.<本名>)、定向通知(eTo.<本名>)都从这里进。
Source§

fn deps(&self) -> &[&str]

D1 显式依赖清单(宿主注册期校验存在性,start 期拓扑排序)。
Source§

fn mailbox_cap(&self) -> usize

邮箱容量覆写(D5:按插件可小可大,默认 MAILBOX_CAP)。
Source§

fn on_init(&self, _ctx: &PluginContext)

可选:启动前纯接线(缓存 ctx、读配置)。禁止在此 put/注册 handler(规范)。
Source§

fn on_start(&self)

start() 按依赖拓扑序调用(只一次)。
Source§

fn on_stop(&self)

close/remove 按逆依赖序调用;调用后保证不再收到邮件。

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.