pub struct LogEntry<Id> { /* private fields */ }Expand description
A structured item displayed by the log viewer.
message is appended directly to the level label so callers can preserve
source formatting such as INFO[0005] ....
Implementations§
Source§impl<Id> LogEntry<Id>
impl<Id> LogEntry<Id>
Sourcepub fn new(id: Id, level: LogLevel, message: impl Into<String>) -> Self
pub fn new(id: Id, level: LogLevel, message: impl Into<String>) -> Self
Creates a log entry with a stable caller-provided identifier.
Examples found in repository?
examples/showcase/app.rs (lines 412-416)
408fn sample_log_entries() -> Vec<material::widget::log_viewer::LogEntry<u64>> {
409 use material::widget::log_viewer::{LogEntry, LogLevel};
410
411 vec![
412 LogEntry::new(
413 1,
414 LogLevel::Info,
415 "[0005] [354884390 0ms] inbound/tun[tun-in]: inbound redirect connection from 172.19.0.1:47892",
416 ),
417 LogEntry::new(
418 2,
419 LogLevel::Info,
420 "[0005] [354884390 0ms] inbound/tun[tun-in]: inbound connection to 81.69.216.240:443",
421 ),
422 LogEntry::new(
423 3,
424 LogLevel::Info,
425 "[0005] [354884390 0ms] router: found user id: 10404",
426 ),
427 LogEntry::new(
428 4,
429 LogLevel::Info,
430 "[0005] [354884390 6ms] outbound/direct[direct]: outbound connection to 81.69.216.240:443",
431 ),
432 LogEntry::new(
433 5,
434 LogLevel::Error,
435 "[0005] [953254993 5.0s] connection: open connection to 172.19.0.2:853 using outbound/direct[direct]: dial tcp 172.19.0.2:853: i/o timeout",
436 ),
437 LogEntry::new(
438 6,
439 LogLevel::Error,
440 "[0005] [2920815984 5.4s] connection: open connection to 172.19.0.2:853 using outbound/direct[direct]: dial tcp 172.19.0.2:853: i/o timeout",
441 ),
442 LogEntry::new(
443 7,
444 LogLevel::Warn,
445 "[0005] router: fallback route selected for user id: 10325",
446 ),
447 LogEntry::new(
448 8,
449 LogLevel::Debug,
450 "[0005] [83404445 0ms] inbound/tun[tun-in]: inbound packet connection from 172.19.0.1:55755",
451 ),
452 LogEntry::new(
453 9,
454 LogLevel::Info,
455 "[0005] [83404445 0ms] inbound/tun[tun-in]: inbound packet connection to 198.18.0.16:443",
456 ),
457 LogEntry::new(
458 10,
459 LogLevel::Trace,
460 "[0005] [83404445 0ms] router: matching route rules",
461 ),
462 LogEntry::new(
463 11,
464 LogLevel::Trace,
465 "[0005] [83404445 0ms] router: rule[3] domain_suffix=.example.com did not match",
466 ),
467 LogEntry::new(
468 12,
469 LogLevel::Debug,
470 "[0005] [83404445 1ms] router: rule[7] ip_cidr=198.18.0.0/15 matched outbound/proxy[edge]",
471 ),
472 LogEntry::new(
473 13,
474 LogLevel::Info,
475 "[0005] [83404445 1ms] outbound/proxy[edge]: dialing 198.18.0.16:443 through 203.0.113.8:8443",
476 ),
477 LogEntry::new(
478 14,
479 LogLevel::Debug,
480 "[0006] dns: query A api.example.com from 172.19.0.1:53044",
481 ),
482 LogEntry::new(
483 15,
484 LogLevel::Trace,
485 "[0006] dns: cache miss for api.example.com IN A",
486 ),
487 LogEntry::new(
488 16,
489 LogLevel::Info,
490 "[0006] dns/doh[remote]: exchange query with https://dns.example/dns-query",
491 ),
492 LogEntry::new(
493 17,
494 LogLevel::Info,
495 "[0006] dns: resolved api.example.com to 198.51.100.42 ttl=300",
496 ),
497 LogEntry::new(
498 18,
499 LogLevel::Debug,
500 "[0005] [83404445 42ms] outbound/proxy[edge]: tunnel established with cipher aes-256-gcm",
501 ),
502 LogEntry::new(
503 19,
504 LogLevel::Info,
505 "[0005] [83404445 43ms] connection: connected to 198.18.0.16:443",
506 ),
507 LogEntry::new(
508 20,
509 LogLevel::Trace,
510 "[0005] [83404445 44ms] connection: uploaded 517 bytes, downloaded 1.8 KiB",
511 ),
512 LogEntry::new(
513 21,
514 LogLevel::Warn,
515 "[0007] inbound/tun[tun-in]: TCP handshake from 172.19.0.1:49102 exceeded 750ms",
516 ),
517 LogEntry::new(
518 22,
519 LogLevel::Info,
520 "[0007] [1653028021 811ms] inbound/tun[tun-in]: inbound connection to 192.0.2.80:80",
521 ),
522 LogEntry::new(
523 23,
524 LogLevel::Debug,
525 "[0007] [1653028021 812ms] router: protocol=http host=updates.example.com method=GET",
526 ),
527 LogEntry::new(
528 24,
529 LogLevel::Info,
530 "[0007] [1653028021 814ms] outbound/direct[direct]: outbound connection to 192.0.2.80:80",
531 ),
532 LogEntry::new(
533 25,
534 LogLevel::Warn,
535 "[0008] inbound/tun[tun-in]: dropped malformed UDP packet from 172.19.0.1:60418",
536 ),
537 LogEntry::new(
538 26,
539 LogLevel::Error,
540 "[0009] outbound/proxy[edge]: authentication failed for 203.0.113.8:8443: invalid server response",
541 ),
542 LogEntry::new(
543 27,
544 LogLevel::Info,
545 "[0009] outbound/proxy[edge]: retrying with secondary endpoint 203.0.113.9:8443",
546 ),
547 LogEntry::new(
548 28,
549 LogLevel::Debug,
550 "[0009] outbound/proxy[edge]: secondary endpoint connected in 68ms",
551 ),
552 LogEntry::new(
553 29,
554 LogLevel::Info,
555 "[0009] connection: traffic recovered after 1 retry",
556 ),
557 LogEntry::new(
558 30,
559 LogLevel::Trace,
560 "[0000] stats: connections=12 upload=4.2 MiB download=38.7 MiB memory=24.6 MiB goroutines=31",
561 ),
562 ]
563}Trait Implementations§
impl<Id: Eq> Eq for LogEntry<Id>
impl<Id: PartialEq> StructuralPartialEq for LogEntry<Id>
Auto Trait Implementations§
impl<Id> Freeze for LogEntry<Id>where
Id: Freeze,
impl<Id> RefUnwindSafe for LogEntry<Id>where
Id: RefUnwindSafe,
impl<Id> Send for LogEntry<Id>where
Id: Send,
impl<Id> Sync for LogEntry<Id>where
Id: Sync,
impl<Id> Unpin for LogEntry<Id>where
Id: Unpin,
impl<Id> UnsafeUnpin for LogEntry<Id>where
Id: UnsafeUnpin,
impl<Id> UnwindSafe for LogEntry<Id>where
Id: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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<State, Message> IntoBoot<State, Message> for State
impl<State, Message> IntoBoot<State, Message> for State
Source§fn into_boot(self) -> (State, Task<Message>)
fn into_boot(self) -> (State, Task<Message>)
Turns some type into the initial state of some
Application.