-
Notifications
You must be signed in to change notification settings - Fork 0
/
lib.rs
38 lines (30 loc) · 845 Bytes
/
lib.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//! `!#[no_std]` streamer for `slog-rs`
#![warn(missing_docs)]
#![no_std]
#[macro_use]
extern crate slog;
use slog::*;
use core::{fmt, result};
/// Formats `Record`-s into `fmt::Write`
pub trait Format: Send + Sync + Sized {
/// Format one logging record and write into `io`
fn format(&self,
_io: &mut fmt::Write,
_info: &Record,
_logger_values: &OwnedKeyValueList)
-> result::Result<(), fmt::Error>;
}
/// `!#[no_std]` streamer
pub struct Streamer<W, F> {
_io : W,
_format : F,
}
impl<W: 'static + fmt::Write + Send+Sync, F: Format + Send> Drain for Streamer<W, F> {
type Error = fmt::Error;
fn log(&self,
_info: &Record,
_logger_values: &OwnedKeyValueList)
-> result::Result<(), fmt::Error> {
Ok(())
}
}