pub struct NetworkLogger { /* private fields */ }Expand description
Logger for network-level events, sync sessions, and relay health.
All records are written to stats.db.
Implementations§
Source§impl NetworkLogger
impl NetworkLogger
Sourcepub fn new(database: StatsDatabase) -> Self
pub fn new(database: StatsDatabase) -> Self
Create a new NetworkLogger backed by the given stats database.
Sourcepub const fn from_arc(database: Arc<StatsDatabase>) -> Self
pub const fn from_arc(database: Arc<StatsDatabase>) -> Self
Create a new NetworkLogger from an already-Arc-wrapped database.
Sourcepub fn record_event(
&self,
network_id: &str,
event: NetworkEventType,
peer: Option<&str>,
details: Option<&str>,
) -> Result<()>
pub fn record_event( &self, network_id: &str, event: NetworkEventType, peer: Option<&str>, details: Option<&str>, ) -> Result<()>
Sourcepub fn record_event_with_metadata(
&self,
network_id: &str,
event: NetworkEventType,
peer: Option<&str>,
details: Option<&str>,
metadata_json: Option<&str>,
) -> Result<()>
pub fn record_event_with_metadata( &self, network_id: &str, event: NetworkEventType, peer: Option<&str>, details: Option<&str>, metadata_json: Option<&str>, ) -> Result<()>
Sourcepub fn record_sync_start(
&self,
network_id: &str,
folder_namespace: &str,
) -> Result<i64>
pub fn record_sync_start( &self, network_id: &str, folder_namespace: &str, ) -> Result<i64>
Record the start of a sync session. Returns the session ID.
§Errors
Returns an error if the database write fails.
Sourcepub fn record_sync_finish(
&self,
session_id: i64,
files: u64,
bytes: u64,
errors: u64,
status: &str,
) -> Result<()>
pub fn record_sync_finish( &self, session_id: i64, files: u64, bytes: u64, errors: u64, status: &str, ) -> Result<()>
Sourcepub fn record_relay_check(
&self,
relay_url: &str,
connected: bool,
latency_ms: Option<i64>,
error_message: Option<&str>,
) -> Result<()>
pub fn record_relay_check( &self, relay_url: &str, connected: bool, latency_ms: Option<i64>, error_message: Option<&str>, ) -> Result<()>
Sourcepub fn recent_events(
&self,
network_id: &str,
limit: usize,
) -> Result<Vec<NetworkEventRecord>>
pub fn recent_events( &self, network_id: &str, limit: usize, ) -> Result<Vec<NetworkEventRecord>>
Sourcepub fn recent_sessions(
&self,
network_id: &str,
limit: usize,
) -> Result<Vec<SyncSessionRecord>>
pub fn recent_sessions( &self, network_id: &str, limit: usize, ) -> Result<Vec<SyncSessionRecord>>
Trait Implementations§
Source§impl Clone for NetworkLogger
impl Clone for NetworkLogger
Source§fn clone(&self) -> NetworkLogger
fn clone(&self) -> NetworkLogger
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for NetworkLogger
impl RefUnwindSafe for NetworkLogger
impl Send for NetworkLogger
impl Sync for NetworkLogger
impl Unpin for NetworkLogger
impl UnsafeUnpin for NetworkLogger
impl UnwindSafe for NetworkLogger
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 more