All Projects → FedericoCeratto → Nim Morelogging

FedericoCeratto / Nim Morelogging

Licence: lgpl-3.0
Logging library for Nim

Programming Languages

nim
578 projects

Projects that are alternatives of or similar to Nim Morelogging

Console
OS X console application.
Stars: ✭ 298 (+927.59%)
Mutual labels:  logging, log, syslog
Quicklogger
Library for logging on files, console, memory, email, rest, eventlog, syslog, slack, telegram, redis, logstash, elasticsearch, influxdb, graylog, Sentry, Twilio, ide debug messages and throw events for Delphi/Firemonkey/freepascal/.NET (Windows/Linux/OSX/IOS/Android).
Stars: ✭ 137 (+372.41%)
Mutual labels:  logging, log, syslog
Raftman
A syslog server with integrated full text search via a JSON API and Web UI
Stars: ✭ 26 (-10.34%)
Mutual labels:  log, syslog
Flowgger
A fast data collector in Rust
Stars: ✭ 606 (+1989.66%)
Mutual labels:  logging, syslog
Gollum
An n:m message multiplexer written in Go
Stars: ✭ 883 (+2944.83%)
Mutual labels:  logging, log
Log4rs
A highly configurable logging framework for Rust
Stars: ✭ 483 (+1565.52%)
Mutual labels:  logging, log
Flog
🎩 A fake log generator for common log formats
Stars: ✭ 531 (+1731.03%)
Mutual labels:  log, syslog
Adenium
Adenium Normalizer
Stars: ✭ 29 (+0%)
Mutual labels:  logging, log
Cocoadebug
iOS Debugging Tool 🚀
Stars: ✭ 3,769 (+12896.55%)
Mutual labels:  logging, log
Electron Log
Just a simple logging module for your Electron application
Stars: ✭ 765 (+2537.93%)
Mutual labels:  logging, log
Dozzle
Realtime log viewer for docker containers.
Stars: ✭ 684 (+2258.62%)
Mutual labels:  logging, log
Logging Helpers
Basic template helpers for printing messages out to the console. Useful for debugging context in templates. Should work with any template engine.
Stars: ✭ 5 (-82.76%)
Mutual labels:  logging, log
Python Coloredlogs
Colored terminal output for Python's logging module
Stars: ✭ 408 (+1306.9%)
Mutual labels:  logging, syslog
Cutelog
GUI for logging
Stars: ✭ 386 (+1231.03%)
Mutual labels:  logging, log
React Log
React for the Console
Stars: ✭ 553 (+1806.9%)
Mutual labels:  logging, log
Go Syslog
Blazing fast syslog parser
Stars: ✭ 370 (+1175.86%)
Mutual labels:  logging, syslog
Semantic logger
Semantic Logger is a feature rich logging framework, and replacement for existing Ruby & Rails loggers.
Stars: ✭ 611 (+2006.9%)
Mutual labels:  logging, syslog
Yii2 Slack Log
Pretty Slack log target for Yii 2
Stars: ✭ 24 (-17.24%)
Mutual labels:  logging, log
Daiquiri
Python library to easily setup basic logging functionality
Stars: ✭ 308 (+962.07%)
Mutual labels:  logging, log
Analog
PHP logging library that is highly extendable and simple to use.
Stars: ✭ 314 (+982.76%)
Mutual labels:  logging, syslog

== Morelogging

A set of logging utilities for Nim.

image:https://img.shields.io/badge/status-beta-orange.svg[badge] image:https://circleci.com/gh/FedericoCeratto/nim-morelogging.svg?style=svg["CircleCI", link="https://circleci.com/gh/FedericoCeratto/nim-morelogging"] image:https://ci.appveyor.com/api/projects/status/github/FedericoCeratto/nim-morelogging?svg=true[Appveyor, link="https://ci.appveyor.com/project/FedericoCeratto/nim-morelogging"] image:https://img.shields.io/github/tag/FedericoCeratto/nim-morelogging.svg[tags] image:https://img.shields.io/badge/License-LGPL%20v3-blue.svg[License]

.Features: [none]

  • [x] File rotation
  • [x] Compression
  • [x] Templated log file name
  • [x] Templated log messages
  • [x] Threaded log buffering
  • [x] Async log buffering
  • [x] Logging, file rotation and compression do not block the caller
  • [x] Sensible defaults: log to "..log", daily log rotation
  • [x] Log to systemd Journald. Support structured entries.
  • [x] Support Linux, OSX, Windows
  • [x] Functional-tested

.Roadmap:

  • [ ] Logging hierarchy
  • [ ] Do not crash the application on write failure (e.g. broken or full disk, permission errors) - switch to logging to stderr
  • [ ] Rotate logfile on SIGHUP signal
  • [ ] Structured logging and optional fields

.Installation [source,bash]

$ # install Nim using APT or from the upstream website $ sudo apt-get install nim $ # install nimble and then: $ nimble install morelogging

.Usage [source,nim]

import morelogging as log

let log = newAsyncFileLogger() log.debug("debug") log.info("info") log.warn("warn") log.error("error") log.fatal("fatal")

=== Log message formatting

The following formatters are supported:

$date $time $datetime $app $appdir $appname $levelid $levelname

Messages with level below level_threshold are ignored.

=== Async and threaded loggers

If buffer_size is positive, messages are buffered internally up to writeout_interval_ms

Messages with level >= flush_threshold are flushed out immediately.

[source,nim]

proc newAsyncFileLogger*( filename_tpl = "$app.$y$MM$dd.log", flush_threshold = lvlError, fmtStr = "$datetime $levelname ", level_threshold = lvlAll, mode: FileMode = fmAppend, writeout_interval_ms = 100, buffer_size = 1_048_576 ): AsyncFileLogger =

proc newThreadFileLogger*( filename_tpl = "$app.$y$MM$dd.log", fmtStr = "$datetime $levelname ", level_threshold = lvlAll, mode: FileMode = fmAppend, writeout_interval_ms = 100, ): ThreadFileLogger =

proc newThreadRotatingFileLogger*( compress = false, filename_tpl = "$app.$y$MM$dd.log", fmtStr = "$datetime $levelname ", level_threshold = lvlAll, mode: FileMode = fmAppend, rotate_interval = "1d", writeout_interval_ms = 100, ): ThreadRotatingFileLogger

==== Generating log file names dynamically

Filenames are generated from filename_tpl Default value: "$app.$y$MM$dd.log" The following formatters are supported:

$y year $MM month $dd day $hh hour $mm minute $ss second $hostname hostname $appname application name

=== Systemd's Journald logger (recommended)

Journald supports logging user-defined key-value pairs and provides fast indexing.

Enable with -d:systemd

.Usage: [source,nim]

let log = newJournaldLogger() log.info("hello world", {"key_1": "value_1"})

Keys are converted to uppercase. They can contain underscores but not as the first character.

JournaldLogger will automatically add CODE_FILE, CODE_FUNC, CODE_LINE keys to show the filename, function and line number that generated the log message.

Note: '--stackTrace:on' and '--lineTrace:on' are required when building in release mode to enable this feature.

You can override them by passing the keys in uppercase with your own values.

.Output example: [source,bash]

sudo journalctl -e -o json-pretty KEY_1=value_1 -n1 --no-pager { "PRIORITY" : "5", "_TRANSPORT" : "journal", "_UID" : "1000", "_GID" : "1000", "MESSAGE" : "hello world", "KEY_1" : "value_1", "CODE_FUNC" : "myfunction", "CODE_FILE" : "mytest.nim", "CODE_LINE" : "24", < other lines redacted > < ... > }

=== Stdout logger

Useful mostly for debugging.

.Usage: [source,nim]

import morelogging let log = newStdoutLogger(fmtStr="$time ") log.info("hello world")

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].