Code Monkey home page Code Monkey logo

ultimatelogger's Introduction

utlimatelogger - A versatile logger for golang

A library to allow logging to multiple outputs using logrus, with the following benefits:

  • log to Telegram, Pushover, Console, Rotating files
  • Configure different text formats for each output
  • Configure different log levels for each output
  • create an easy-to-use logger of logrus.Logger type
  • singleton version, so can be init once and used everywhere without passing the logger around
  • configuration can be done via a config file (toml) or via code - and also by giving the config file path as a env variable
  • standard, default configuration that allows the user to create a minimal config.toml file, or to change many options if needed

Usage

There are two configuration files that are needed for the ultimate logger.
One is the defaultConfig.toml - this defines default and most common parameters for each logging output. Do not change the default config file. Use the specific config file to override values.
The second is ultimateLogger.toml - this is the main configuration file. Here the user specify the parameters for each service (api keys, logfile names etc.) and any other override of the defaults.

So the user need only create the ultimateLogger.toml and use: On the first run the defaultConfig.toml will be created for you. you may use the sample ultimateLogger.toml file as a starting point.
If the user does not create the config file ultimatelogger.toml a skeleton file will be created for you.

package main
import "github.com/razstreinmetz/ultimateLogger"

func main() {
    log:=UltimateLogger()

	
	log.Info("This is an info message")
}

Important Notice

The logging to telegram, pushover is done using go routines. Thus if the program exist right after the logging the messages might not be sent. Add a short sleep before the exit to avoid it. Panic and fatal messages will be waited a bit by default.

TODO

ultimatelogger's People

Contributors

razsteinmetz avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.