#logging #console-log #coralogix

no-std service-logging

Asynchronous structured logging in tiny library (6KB) with clients for Coralogix and console.log. WASM compatible

14 releases

0.4.7 Feb 16, 2021
0.4.6 Feb 12, 2021
0.4.5 Jan 23, 2021
0.4.1 Dec 31, 2020
0.2.6 Dec 3, 2020

#528 in Debugging


Used in 3 crates

MIT/Apache

20KB
335 lines

Asynchronous structured logging in tiny library (6KB) with clients for Coralogix and console.log. WASM compatible.

Usage

Use the log! macro to log key-value pairs, which are json-encoded before sending to logging service

use service_logging::{log, LogQueue, Severity::{Info,Error}};
let logger =  CoralogixLogger::init(CoralogixConfig{
    api_key: "0000",
    application_name: "MyApp",
    endpoint: "https://api.coralogix.com/api/v1/logs"});
let mut lq = LogQueue::default();

log!(lq, Info, 
  method: "GET",
  url: url,
  status: 200
);

log!(lq, Error,
  user: user,
  message: "Too many failed login attempts",
  attempts: count
);

logger.send("http", lq.take()).await?;

lib.rs:

Library for aggregating logs and sending to logging service. Contains implementations for Coralogix and (for wasm) console.log

Dependencies

~4–16MB
~249K SLoC