#slog #log #logging

macro slog-extlog-derive

Custom derive code for slog-extlog

9 stable releases

✓ Uses Rust 2018 edition

5.3.0 Apr 16, 2020
5.2.1 Jul 12, 2019
5.2.0 Jun 25, 2019
5.1.0 May 30, 2019
3.2.0 Apr 25, 2018

#229 in Debugging

Download history 24/week @ 2020-02-08 4/week @ 2020-02-15 73/week @ 2020-02-22 21/week @ 2020-02-29 19/week @ 2020-03-07 30/week @ 2020-03-14 51/week @ 2020-03-21 27/week @ 2020-03-28 45/week @ 2020-04-04 92/week @ 2020-04-11 22/week @ 2020-04-18 17/week @ 2020-04-25 15/week @ 2020-05-02 217/week @ 2020-05-09 161/week @ 2020-05-16 93/week @ 2020-05-23

139 downloads per month
Used in slog-extlog

Apache-2.0 and MPL-2.0 licenses

110KB
1.5K SLoC

Ruby 1K SLoC // 0.4% comments Rust 497 SLoC // 0.3% comments

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

~6.5MB
~124K SLoC