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 433-437)
429fn sample_log_entries() -> Vec<material::widget::log_viewer::LogEntry<u64>> {
430 use material::widget::log_viewer::{LogEntry, LogLevel};
431
432 vec![
433 LogEntry::new(
434 1,
435 LogLevel::Info,
436 "[0005] [354884390 0ms] inbound/tun[tun-in]: inbound redirect connection from 172.19.0.1:47892",
437 ),
438 LogEntry::new(
439 2,
440 LogLevel::Info,
441 "[0005] [354884390 0ms] inbound/tun[tun-in]: inbound connection to 81.69.216.240:443",
442 ),
443 LogEntry::new(
444 3,
445 LogLevel::Info,
446 "[0005] [354884390 0ms] router: found user id: 10404",
447 ),
448 LogEntry::new(
449 4,
450 LogLevel::Info,
451 "[0005] [354884390 6ms] outbound/direct[direct]: outbound connection to 81.69.216.240:443",
452 ),
453 LogEntry::new(
454 5,
455 LogLevel::Error,
456 "[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",
457 ),
458 LogEntry::new(
459 6,
460 LogLevel::Error,
461 "[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",
462 ),
463 LogEntry::new(
464 7,
465 LogLevel::Warn,
466 "[0005] router: fallback route selected for user id: 10325",
467 ),
468 LogEntry::new(
469 8,
470 LogLevel::Debug,
471 "[0005] [83404445 0ms] inbound/tun[tun-in]: inbound packet connection from 172.19.0.1:55755",
472 ),
473 LogEntry::new(
474 9,
475 LogLevel::Info,
476 "[0005] [83404445 0ms] inbound/tun[tun-in]: inbound packet connection to 198.18.0.16:443",
477 ),
478 LogEntry::new(
479 10,
480 LogLevel::Trace,
481 "[0005] [83404445 0ms] router: matching route rules",
482 ),
483 LogEntry::new(
484 11,
485 LogLevel::Trace,
486 "[0005] [83404445 0ms] router: rule[3] domain_suffix=.example.com did not match",
487 ),
488 LogEntry::new(
489 12,
490 LogLevel::Debug,
491 "[0005] [83404445 1ms] router: rule[7] ip_cidr=198.18.0.0/15 matched outbound/proxy[edge]",
492 ),
493 LogEntry::new(
494 13,
495 LogLevel::Info,
496 "[0005] [83404445 1ms] outbound/proxy[edge]: dialing 198.18.0.16:443 through 203.0.113.8:8443",
497 ),
498 LogEntry::new(
499 14,
500 LogLevel::Debug,
501 "[0006] dns: query A api.example.com from 172.19.0.1:53044",
502 ),
503 LogEntry::new(
504 15,
505 LogLevel::Trace,
506 "[0006] dns: cache miss for api.example.com IN A",
507 ),
508 LogEntry::new(
509 16,
510 LogLevel::Info,
511 "[0006] dns/doh[remote]: exchange query with https://dns.example/dns-query",
512 ),
513 LogEntry::new(
514 17,
515 LogLevel::Info,
516 "[0006] dns: resolved api.example.com to 198.51.100.42 ttl=300",
517 ),
518 LogEntry::new(
519 18,
520 LogLevel::Debug,
521 "[0005] [83404445 42ms] outbound/proxy[edge]: tunnel established with cipher aes-256-gcm",
522 ),
523 LogEntry::new(
524 19,
525 LogLevel::Info,
526 "[0005] [83404445 43ms] connection: connected to 198.18.0.16:443",
527 ),
528 LogEntry::new(
529 20,
530 LogLevel::Trace,
531 "[0005] [83404445 44ms] connection: uploaded 517 bytes, downloaded 1.8 KiB",
532 ),
533 LogEntry::new(
534 21,
535 LogLevel::Warn,
536 "[0007] inbound/tun[tun-in]: TCP handshake from 172.19.0.1:49102 exceeded 750ms",
537 ),
538 LogEntry::new(
539 22,
540 LogLevel::Info,
541 "[0007] [1653028021 811ms] inbound/tun[tun-in]: inbound connection to 192.0.2.80:80",
542 ),
543 LogEntry::new(
544 23,
545 LogLevel::Debug,
546 "[0007] [1653028021 812ms] router: protocol=http host=updates.example.com method=GET",
547 ),
548 LogEntry::new(
549 24,
550 LogLevel::Info,
551 "[0007] [1653028021 814ms] outbound/direct[direct]: outbound connection to 192.0.2.80:80",
552 ),
553 LogEntry::new(
554 25,
555 LogLevel::Warn,
556 "[0008] inbound/tun[tun-in]: dropped malformed UDP packet from 172.19.0.1:60418",
557 ),
558 LogEntry::new(
559 26,
560 LogLevel::Error,
561 "[0009] outbound/proxy[edge]: authentication failed for 203.0.113.8:8443: invalid server response",
562 ),
563 LogEntry::new(
564 27,
565 LogLevel::Info,
566 "[0009] outbound/proxy[edge]: retrying with secondary endpoint 203.0.113.9:8443",
567 ),
568 LogEntry::new(
569 28,
570 LogLevel::Debug,
571 "[0009] outbound/proxy[edge]: secondary endpoint connected in 68ms",
572 ),
573 LogEntry::new(
574 29,
575 LogLevel::Info,
576 "[0009] connection: traffic recovered after 1 retry",
577 ),
578 LogEntry::new(
579 30,
580 LogLevel::Trace,
581 "[0000] stats: connections=12 upload=4.2 MiB download=38.7 MiB memory=24.6 MiB goroutines=31",
582 ),
583 ]
584}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.