• Stars
    star
    225
  • Rank 177,187 (Top 4 %)
  • Language
    Rust
  • License
    MIT License
  • Created almost 10 years ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A rust logger that prints all messages with a readable output format.

simple_logger

A logger that prints all messages with a readable output format.

The output format is based on the format used by Supervisord, with timestamps default RFC 3339 format. The format used for timestamps can be customised.

Breaking changes

  • Version 2.0.0 changes the default from displaying timestamps in the local timezone to displaying timestamps in UTC. See issue #52 for more information.

Usage

use simple_logger::SimpleLogger;

fn main() {
    SimpleLogger::new().init().unwrap();

    log::warn!("This is an example message.");
}

This outputs:

2022-01-19T17:27:07.013874956Z WARN [logging_example] This is an example message.

You can run the above example with:

cargo run --example init

The colors and timestamps features are enabled by default. You can remove these features and their respective dependencies by disabling all features in your Cargo.toml.

[dependencies.simple_logger]
default-features = false

To include the timestamps feature, but not the colors feature:

[dependencies.simple_logger]
default-features = false
features = ["timestamps"]

To include the colors feature, but not the timestamps feature:

[dependencies.simple_logger]
default-features = false
features = ["colors"]

To include thread metadata use the threads and nightly features:

[dependencies.simple_logger]
features = ["threads", "nightly"]

To direct logging output to stderr use the stderr feature:

[dependencies.simple_logger]
features = ["stderr"]

Multiple features can be combined.

[dependencies.simple_logger]
features = ["colors", "threads", "timestamps", "nightly", "stderr"]

Licence

simple_logger is licenced under the MIT Licence.

Authors

Written by Sam Clements.

More Repositories

1

python-colorlog

A colored formatter for the python logging module
Python
891
star
2

python-dice

Dice parsing and evaluation library
Python
85
star
3

python-infix

An experiment to use infix operators in Python
Python
56
star
4

python-riemann-client

A Riemann client and command line tool
Python
40
star
5

spotter

A command line tool for watching files and running shell commands when they change
Python
27
star
6

supermann

A process monitor that connects Supervisor and Riemann
Python
18
star
7

jsonlog

Structured logging tools
Python
14
star
8

rust-riemann_client

A Riemann client library for Rust
Rust
9
star
9

sous-chef

A web frontend for the Chef server index
HTML
8
star
10

deployment

Ansible configuration for my workstations and servers
Shell
7
star
11

watch-fs

Run commands when file change
Python
6
star
12

ssh-run

Sequentially run commands on multiple servers
Python
6
star
13

v

A tiny virtualenv manager
Shell
5
star
14

diceroll

Use https://github.com/borntyping/python-dice instead
Python
4
star
15

python-jsonlog

JSON log formatting for the Python logging library.
Python
3
star
16

switchbox

Python
3
star
17

borntyping.github.io

CSS
2
star
18

nus

Nice Urls, Simple CMS
PHP
2
star
19

vancelle

A personal webapp for tracking books, games, films and shows.
Python
2
star
20

python-argumented

A lightweight unittesting module for running tests with multiple sets of arguments
Python
1
star
21

mannhunter

A memory monitoring tool for Supervisor and Riemann
Python
1
star
22

jsonlog-cli

Human readable formatter for JSON logs.
Python
1
star
23

ffxiv-daily-quest-tracker

HTML
1
star
24

clack

Run multiple iterations of the same command from a stored configuration
Python
1
star
25

mashinky-calculator

Calculate optimal trains for Mashinky
Python
1
star