#logging #wasm #coralogix

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

#520 in WebAssembly

Download history 33/week @ 2022-03-11 76/week @ 2022-03-18 6/week @ 2022-03-25 4/week @ 2022-04-01 6/week @ 2022-04-08 5/week @ 2022-04-15 20/week @ 2022-04-22 101/week @ 2022-04-29 86/week @ 2022-05-06 244/week @ 2022-05-13 46/week @ 2022-05-20 124/week @ 2022-05-27 119/week @ 2022-06-03 5/week @ 2022-06-10 7/week @ 2022-06-17 10/week @ 2022-06-24

157 downloads per month
Used in 3 crates

MIT/Apache

18KB
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

~3–13MB
~264K SLoC