All Projects → nk412 → tinylogger

nk412 / tinylogger

Licence: MIT license
Lightweight logging framework for bash

Programming Languages

shell
77523 projects

Projects that are alternatives of or similar to tinylogger

clue
a extremely high performance log library for android. 高性能的Android日志库
Stars: ✭ 27 (-22.86%)
Mutual labels:  logging-library
logging2
A More Pythonic Logging System
Stars: ✭ 22 (-37.14%)
Mutual labels:  logging-library
Flogs
An Advanced Logging Framework develop in flutter that provides quick & simple logging solution.
Stars: ✭ 158 (+351.43%)
Mutual labels:  logging-library
l
Cross-platform html/io [L]ogger with simple API.
Stars: ✭ 26 (-25.71%)
Mutual labels:  logging-library
Simple-Log
dnkpp.github.io/Simple-Log/
Stars: ✭ 13 (-62.86%)
Mutual labels:  logging-library
Loggaby
📝 A simple, lightweight and customizable logger.
Stars: ✭ 20 (-42.86%)
Mutual labels:  logging-library
ULog
Unified cross-platform logging framework for C, C++, Objective-C, Swift, ASL and C#.
Stars: ✭ 13 (-62.86%)
Mutual labels:  logging-library
chronica
Logger framework for Erlang applications
Stars: ✭ 57 (+62.86%)
Mutual labels:  logging-library
tracelog
TraceLog is a highly configurable, flexible, portable, and simple to use debug logging system for Swift and Objective-C applications running on Linux, macOS, iOS, watchOS, and tvOS.
Stars: ✭ 52 (+48.57%)
Mutual labels:  logging-library
monolog-google-cloud-json-formatter
A Monolog extension for formatting log entries for Google Cloud Logging
Stars: ✭ 15 (-57.14%)
Mutual labels:  logging-library
Arduino-Log
Simple application log library. supporting multiple log levels, custom output & flash memory support.
Stars: ✭ 132 (+277.14%)
Mutual labels:  logging-library
beautiful logger
Yet another logger API in Java with beautiful features
Stars: ✭ 60 (+71.43%)
Mutual labels:  logging-library
Meteor-logger-mongo
🍃 Meteor Logging: Store application log messages in MongoDB
Stars: ✭ 20 (-42.86%)
Mutual labels:  logging-library
noodlog
🍜 Parametrized JSON logging library in Golang which lets you obfuscate sensitive data and marshal any kind of content.
Stars: ✭ 42 (+20%)
Mutual labels:  logging-library
BLogger
An easy to use modern C++14/17 async cross-platform logger which supports custom formatting/patterns, colored output, Unicode, file logging, log rotation & more!
Stars: ✭ 23 (-34.29%)
Mutual labels:  logging-library
Prism.Plugin.Logging
Enables remote logging services for Prism Applications
Stars: ✭ 76 (+117.14%)
Mutual labels:  logging-library
ratlog.js
🐀 Ratlog JavaScript library - Application Logging for Rats, Humans and Machines
Stars: ✭ 24 (-31.43%)
Mutual labels:  logging-library
moesif-nodejs
Moesif Nodejs Middleware Library (formerly Moesif-Express)
Stars: ✭ 36 (+2.86%)
Mutual labels:  logging-library
use-reducer-logger
A very basic logger for the useReducer function in the React Hooks API.
Stars: ✭ 89 (+154.29%)
Mutual labels:  logging-library
KmLogging
Kotlin multiplatform logging. High performance, composable and simple to use.
Stars: ✭ 21 (-40%)
Mutual labels:  logging-library

tinylogger

An extremely lightweight logging framework for BASH scripts. Developed and tested on MacOS. This should work on any BASH platform.

Log levels

It supports four levels, default being INFO.

ERROR > WARN > INFO > DEBUG

Usage

Source the tinylogger.bash file, and use the tlog method. The first argument is the level, and the second the log message.

source tinylogger.bash
tlog warn "This is a warning"

See demo.sh for more.

You can control the logging level while calling a script by setting the LOGGER_LVL argument.

$ LOGGER_LVL=warn ./demo.sh
2017-11-07 19:05:30 - WARN - This is a scary warning
2017-11-07 19:05:30 - ERROR - Something terrible has happened
$ LOGGER_LVL=debug ./demo.sh
2017-11-07 19:05:52 - DEBUG - first line of script
2017-11-07 19:05:52 - INFO - Starting script ./demo.sh
2017-11-07 19:05:52 - DEBUG - another debug statement
2017-11-07 19:05:52 - INFO - Current time is Tue  7 Nov 2017 19:05:52 GMT
2017-11-07 19:05:52 - WARN - This is a scary warning
2017-11-07 19:05:52 - DEBUG - do you like these debug statements?
2017-11-07 19:05:52 - ERROR - Something terrible has happened
2017-11-07 19:05:52 - DEBUG - end of script
2017-11-07 19:05:52 - INFO - Script completed, go home

You can set LOGGER_LVL=none to disable all logging.

Timestamp customisation

Underneath, the date command is used to display the timestamp. Simply set the LOGGER_FMT to any valid format supported by date.

$ LOGGER_LVL=warn LOGGER_FMT=%s ./demo.sh
1510081622 - WARN - This is a scary warning
1510081622 - ERROR - Something terrible has happened

License

MIT

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].