All Projects → birkirb → loggers

birkirb / loggers

Licence: MIT license
Abstract logging for Golang projects. A kind of log4go in the spirit of log4j

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to loggers

telegram-log
Send a Telegram message when your scripts fire an exception or when they finish their execution.
Stars: ✭ 16 (-5.88%)
Mutual labels:  log4j, logger
herald
Log annotation for logging frameworks
Stars: ✭ 71 (+317.65%)
Mutual labels:  log4j, logger
liquibase-slf4j
Liquibase SLF4J Logger.
Stars: ✭ 42 (+147.06%)
Mutual labels:  log4j, logger
Shogun
Shodan.io Command Line Interface
Stars: ✭ 42 (+147.06%)
Mutual labels:  interface
QuickTraceiOSLogger
A real time iOS log trace tool, view iOS log with pc web browser under local area network, which will automatically scroll like xcode. 一个实时的iOS日志跟踪工具,在局域网中使用 PC Web 浏览器查看 iOS 日志,它将像xcode一样自动滚动。
Stars: ✭ 16 (-5.88%)
Mutual labels:  logger
junit.testlogger
JUnit test logger for vstest platform
Stars: ✭ 61 (+258.82%)
Mutual labels:  logger
l
Golang Pretty Logger
Stars: ✭ 51 (+200%)
Mutual labels:  logger
mini-async-log-c
Mini async log C port. Now with C++ wrappers.
Stars: ✭ 69 (+305.88%)
Mutual labels:  logger
WormholyForObjectiveC
Network debugging made easy,This network debugging tool is developed based on the swift version of Wormholy.
Stars: ✭ 21 (+23.53%)
Mutual labels:  logger
LogMePwn
A fully automated, reliable, super-fast, mass scanning and validation toolkit for the Log4J RCE CVE-2021-44228 vulnerability.
Stars: ✭ 362 (+2029.41%)
Mutual labels:  log4j
Fluent-Design-For-Web
Windows 10 Inspired UI For Web
Stars: ✭ 28 (+64.71%)
Mutual labels:  interface
MIDI.jl
A Julia library for handling MIDI files
Stars: ✭ 55 (+223.53%)
Mutual labels:  interface
typeclass-interface-pattern
Ideas, thoughts, and notes on a typeclass/interface based polymorphism pattern for standard C
Stars: ✭ 26 (+52.94%)
Mutual labels:  interface
datalogger
DataLogger foi projetado para ser uma biblioteca simples de log com suporte a vários providers.
Stars: ✭ 46 (+170.59%)
Mutual labels:  logger
ui bibz
Ui Framework based on Bootstrap and Ruby on Rails
Stars: ✭ 13 (-23.53%)
Mutual labels:  interface
significa.co
Significa - A digital design-led agency focused on product development.
Stars: ✭ 72 (+323.53%)
Mutual labels:  interface
Torch-Scope
A Toolkit for Training, Tracking, Saving Models and Syncing Results
Stars: ✭ 62 (+264.71%)
Mutual labels:  logger
DustViewerSharp
UART-USB based dust sensor viewer(and also logging) program by C#
Stars: ✭ 38 (+123.53%)
Mutual labels:  logger
log
Aplus Framework Log Library
Stars: ✭ 14 (-17.65%)
Mutual labels:  logger
ng-logger
Angular logger service
Stars: ✭ 65 (+282.35%)
Mutual labels:  logger

loggers : Golang Abstract Loggers

loggers define an abstract and common logging interface in three flavors.

GoDoc Build Status

Inspiration

If you have been using Go for a while, you've probably been asking yourself: "Why, oh why, wasn't the standard library logger made an interface!?" Often was I faced with having to decide about what kind of logger I needed before I was ready to, wondering:

  • Where's Golang's answer to log4j ?
  • Is there a log4go or log4golang ?

Well this package should help. Install and call log.Info("Log all my stuff") and you're off and you can easily switch out loggers later with only a single line of code.

Design

All loggers are interfaces and should be declared and used as such. The actual implementations can vary and are easily switched out. The main packages should have no external dependencies. See here.

Standard

Standard interface is the same as used by the Go standard library log package.

Advanced

A common pattern for level discrete loggers using debug, info, warn and error levels, along with those defined by the standard interface.

Contextual

A superset of Advanced, adds contextual logging, such that lines can have a number of additional parameters set to provide clearer separation of message and context.

Installation

go get gopkg.in/birkirb/loggers.v1

Usage

You can choose between declaring one of the three interfaces above that best suits your needs, or use the built in Contextual interface directly with a default standard library logger implementation to do your bidding. You can switch out all the loggers later as long as they satisfy the right interface.

Direct

You can use the loggers interface as a drop in replacement for the standard library logger. Just change your import statement from "log" to "gopkg.in/birkirb/loggers.v1/log". It should work just the same and you can make use of advanced and contextual methods only if you so decide. You can then easily switch out the log package implementation later with your own logger as long as it implements the Contextual interface.

    log.Infof("Logger is started") // Defaults to stdout.
    log.Logger = stdlib.NewLogger(fileWriter, "", log.LstdFlags)
    log.Infof("Now logging to fileWriter") // writes to fileWriter

Embedded

Declare your own project logging interface.

import (
    "log"

    "gopkg.in/birkirb/loggers.v1"
)

var Logger loggers.Standard

func init() {
    Logger = log.New(writer, "myapp", log.LstdFlags)
    Logger.Println("Logger is started")
}

Mappers

A few loggers have been mapped to the above interfaces and could thus be used with any of them. Instead of the using the Standard logger as above, we could use the standard logger much like a leveled logger.

import (
    "gopkg.in/birkirb/loggers.v1"
    "gopkg.in/birkirb/loggers.v1/mappers/stdlib"
)

var Logger loggers.Advanced

func init() {
    Logger = stdlib.NewDefaultLogger()
    Logger.Info("Logger is started")
}

A level mapper exist to ease with implementing plugins/mappers for other loggers that don't naturally implement any of the designed interfaces. This can be found in the mappers package.

Existing mappers

Contributing

Any new mappers for different Go logging solutions would be most welcome.

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