#slog #log #logging

slog-extlog

Object-based logging and statistics tracking through logs

8 stable releases

✓ Uses Rust 2018 edition

5.2.1 Jul 12, 2019
5.2.0 Jun 25, 2019
5.1.0 May 30, 2019
5.0.0 Aug 23, 2018
3.2.0 Apr 25, 2018

#69 in Debugging

Download history 73/week @ 2019-03-29 52/week @ 2019-04-05 16/week @ 2019-04-12 3/week @ 2019-04-19 33/week @ 2019-04-26 8/week @ 2019-05-03 13/week @ 2019-05-10 13/week @ 2019-05-17 33/week @ 2019-05-24 63/week @ 2019-05-31 80/week @ 2019-06-07 96/week @ 2019-06-14 47/week @ 2019-06-21 51/week @ 2019-06-28 30/week @ 2019-07-05

163 downloads per month
Used in 2 crates (1 directly)

Apache-2.0

70KB
1K SLoC

This crate adds support for external logs, and for statistics tracking through those logs, to the slog ecosystem.

This crate was written by Metaswitch Networks (@Metaswitch) and made freely available under the Apache License. Contributions are welcome.

Overview

External logs are logs that form an external API that end users can rely on, and that do not change without explicit agreement. Using them allows you to treat logs as objects, rather than strings with metadata, allowing compile-time checking of logs.

This repository provides the following.

  • An API for easily defining external logs.
  • An API for defining statistic values to track, and to modify them based on the external logs
  • A StatisticsLogger type that wraps an slog::Logger, which handles logging and updating tracked stats.
  • An xlog! macro for making the logs through the StatisticsLogger.
  • An API for retrieving the current values of all stats from the StatisticsLogger.

Use of this crate

In theory, an external log can be defined simply by making any type implement ExtLoggable. In practice, external logs will be generated by auto-deriving the ExtLoggable trait using the slog-extlog-derive crate from this repository.

Logs can then be generated by using the xlog! macro to make the logs using a StatisticsLogger - a wrapper around slog::Logger which can also track stats.

For more details, see:

Dependencies

~5.5MB
~102K SLoC