pub struct LogEntry { /* private fields */ }Implementations§
Source§impl LogEntry
impl LogEntry
Sourcepub fn new(body: impl Into<String>) -> Self
pub fn new(body: impl Into<String>) -> Self
Examples found in repository?
examples/simple_usage.rs (line 25)
9fn main() {
10 // You can omit this when MASTER_LOG_API_KEY and MASTER_LOG_ENDPOINT are set.
11 configure(
12 MasterLogConfig::from_env()
13 .api_key("dev-key")
14 .endpoint("http://127.0.0.1:8000")
15 .min_request_interval(Duration::from_millis(20))
16 .batch_size(100),
17 );
18
19 mlog("Telescope array online");
20 mlogf!("Captured frame {} for {}", 42, "M31");
21
22 info("Flat-field calibration completed");
23
24 log_entry(
25 LogEntry::new("Dome slit wind threshold approaching")
26 .severity(Severity::Warn)
27 .tags(["dome", "weather"])
28 .metadata(json!({ "wind_knots": 28, "limit_knots": 32 })),
29 );
30
31 warn("Seeing degraded");
32
33 log_entry(
34 LogEntry::with_title("Camera cooling alert", "CCD cooling loop failed to settle")
35 .severity(Severity::Error)
36 .tags(["ccd", "camera"])
37 .metadata(json!({ "setpoint_celsius": -20, "actual_celsius": -16.8 })),
38 );
39
40 error("Mount tracking watchdog tripped");
41
42 let result = flush(Duration::from_secs(5));
43 if !result.ok {
44 eprintln!(
45 "Master Log flush failed: {}",
46 result.error.unwrap_or_default()
47 );
48 }
49}Sourcepub fn with_title(title: impl Into<String>, body: impl Into<String>) -> Self
pub fn with_title(title: impl Into<String>, body: impl Into<String>) -> Self
Examples found in repository?
examples/simple_usage.rs (line 34)
9fn main() {
10 // You can omit this when MASTER_LOG_API_KEY and MASTER_LOG_ENDPOINT are set.
11 configure(
12 MasterLogConfig::from_env()
13 .api_key("dev-key")
14 .endpoint("http://127.0.0.1:8000")
15 .min_request_interval(Duration::from_millis(20))
16 .batch_size(100),
17 );
18
19 mlog("Telescope array online");
20 mlogf!("Captured frame {} for {}", 42, "M31");
21
22 info("Flat-field calibration completed");
23
24 log_entry(
25 LogEntry::new("Dome slit wind threshold approaching")
26 .severity(Severity::Warn)
27 .tags(["dome", "weather"])
28 .metadata(json!({ "wind_knots": 28, "limit_knots": 32 })),
29 );
30
31 warn("Seeing degraded");
32
33 log_entry(
34 LogEntry::with_title("Camera cooling alert", "CCD cooling loop failed to settle")
35 .severity(Severity::Error)
36 .tags(["ccd", "camera"])
37 .metadata(json!({ "setpoint_celsius": -20, "actual_celsius": -16.8 })),
38 );
39
40 error("Mount tracking watchdog tripped");
41
42 let result = flush(Duration::from_secs(5));
43 if !result.ok {
44 eprintln!(
45 "Master Log flush failed: {}",
46 result.error.unwrap_or_default()
47 );
48 }
49}Sourcepub fn severity(self, value: Severity) -> Self
pub fn severity(self, value: Severity) -> Self
Examples found in repository?
examples/simple_usage.rs (line 26)
9fn main() {
10 // You can omit this when MASTER_LOG_API_KEY and MASTER_LOG_ENDPOINT are set.
11 configure(
12 MasterLogConfig::from_env()
13 .api_key("dev-key")
14 .endpoint("http://127.0.0.1:8000")
15 .min_request_interval(Duration::from_millis(20))
16 .batch_size(100),
17 );
18
19 mlog("Telescope array online");
20 mlogf!("Captured frame {} for {}", 42, "M31");
21
22 info("Flat-field calibration completed");
23
24 log_entry(
25 LogEntry::new("Dome slit wind threshold approaching")
26 .severity(Severity::Warn)
27 .tags(["dome", "weather"])
28 .metadata(json!({ "wind_knots": 28, "limit_knots": 32 })),
29 );
30
31 warn("Seeing degraded");
32
33 log_entry(
34 LogEntry::with_title("Camera cooling alert", "CCD cooling loop failed to settle")
35 .severity(Severity::Error)
36 .tags(["ccd", "camera"])
37 .metadata(json!({ "setpoint_celsius": -20, "actual_celsius": -16.8 })),
38 );
39
40 error("Mount tracking watchdog tripped");
41
42 let result = flush(Duration::from_secs(5));
43 if !result.ok {
44 eprintln!(
45 "Master Log flush failed: {}",
46 result.error.unwrap_or_default()
47 );
48 }
49}pub fn severity_str( self, value: impl AsRef<str>, ) -> Result<Self, MasterLogError>
pub fn title(self, value: impl Into<String>) -> Self
pub fn tag(self, value: impl Into<String>) -> Self
Examples found in repository?
examples/simple_usage.rs (line 27)
9fn main() {
10 // You can omit this when MASTER_LOG_API_KEY and MASTER_LOG_ENDPOINT are set.
11 configure(
12 MasterLogConfig::from_env()
13 .api_key("dev-key")
14 .endpoint("http://127.0.0.1:8000")
15 .min_request_interval(Duration::from_millis(20))
16 .batch_size(100),
17 );
18
19 mlog("Telescope array online");
20 mlogf!("Captured frame {} for {}", 42, "M31");
21
22 info("Flat-field calibration completed");
23
24 log_entry(
25 LogEntry::new("Dome slit wind threshold approaching")
26 .severity(Severity::Warn)
27 .tags(["dome", "weather"])
28 .metadata(json!({ "wind_knots": 28, "limit_knots": 32 })),
29 );
30
31 warn("Seeing degraded");
32
33 log_entry(
34 LogEntry::with_title("Camera cooling alert", "CCD cooling loop failed to settle")
35 .severity(Severity::Error)
36 .tags(["ccd", "camera"])
37 .metadata(json!({ "setpoint_celsius": -20, "actual_celsius": -16.8 })),
38 );
39
40 error("Mount tracking watchdog tripped");
41
42 let result = flush(Duration::from_secs(5));
43 if !result.ok {
44 eprintln!(
45 "Master Log flush failed: {}",
46 result.error.unwrap_or_default()
47 );
48 }
49}Sourcepub fn metadata(self, value: Value) -> Self
pub fn metadata(self, value: Value) -> Self
Examples found in repository?
examples/simple_usage.rs (line 28)
9fn main() {
10 // You can omit this when MASTER_LOG_API_KEY and MASTER_LOG_ENDPOINT are set.
11 configure(
12 MasterLogConfig::from_env()
13 .api_key("dev-key")
14 .endpoint("http://127.0.0.1:8000")
15 .min_request_interval(Duration::from_millis(20))
16 .batch_size(100),
17 );
18
19 mlog("Telescope array online");
20 mlogf!("Captured frame {} for {}", 42, "M31");
21
22 info("Flat-field calibration completed");
23
24 log_entry(
25 LogEntry::new("Dome slit wind threshold approaching")
26 .severity(Severity::Warn)
27 .tags(["dome", "weather"])
28 .metadata(json!({ "wind_knots": 28, "limit_knots": 32 })),
29 );
30
31 warn("Seeing degraded");
32
33 log_entry(
34 LogEntry::with_title("Camera cooling alert", "CCD cooling loop failed to settle")
35 .severity(Severity::Error)
36 .tags(["ccd", "camera"])
37 .metadata(json!({ "setpoint_celsius": -20, "actual_celsius": -16.8 })),
38 );
39
40 error("Mount tracking watchdog tripped");
41
42 let result = flush(Duration::from_secs(5));
43 if !result.ok {
44 eprintln!(
45 "Master Log flush failed: {}",
46 result.error.unwrap_or_default()
47 );
48 }
49}pub fn metadata_field( self, key: impl Into<String>, value: impl Serialize, ) -> Self
pub fn ttl_seconds(self, value: u64) -> Self
pub fn expires_at(self, value: DateTime<Utc>) -> Self
pub fn created_at(self, value: DateTime<Utc>) -> Self
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LogEntry
impl RefUnwindSafe for LogEntry
impl Send for LogEntry
impl Sync for LogEntry
impl Unpin for LogEntry
impl UnsafeUnpin for LogEntry
impl UnwindSafe for LogEntry
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