Skip to content

Aggregate structured logs for sending to external service; contains implementations for Coralogix and (for wasm) console.log.

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

stevelr/service-logging

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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?;

About

Aggregate structured logs for sending to external service; contains implementations for Coralogix and (for wasm) console.log.

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages