Package for multi-level logging

Logdump

Godoc Reference Build Status Go Report Card

Package for writing logs to multiple files

Usage

$ go get github.com/ewwwwwqm/logdump

Example

main.go

package main

import (
	"log"

	"github.com/ewwwwwqm/logdump"
)

func main() {
	// create message zones and assign files for output
	newLog := map[string]interface{}{
		"error": "error.log",
		"warning": "warning.log",
		"notice": "notice.log",
	}

	// init logger
	logdump.Init(newLog)

	// for ex. dump error
	logdump.Write("error", "something had an error")

	// default output
	log.Println("Standard output to os.Stderr")

	// few more errors
	logdump.Write("notice", "some notice")
	logdump.Write("error", "another error")
	logdump.Write("warning", "fancy warning")

	// wrong message zone, output to os.Stderr
	logdump.Write("wrong_zone", "fail")
}

Before running:

Before run

Run the app:

$ go run main.go

After run

Files were created.

Output

os.Stderr:

2017/01/13 17:45:48 Standard output to os.Stderr
2017/01/13 17:45:48 Type wrong_zone was not assigned for log output

error.log

2017/01/13 17:45:48 Start error logging
2017/01/13 17:45:48 something had an error
2017/01/13 17:45:48 another error

warning.log

2017/01/13 17:45:48 Start warning logging
2017/01/13 17:45:48 fancy warning

notice.log

2017/01/13 17:45:48 Start notice logging
2017/01/13 17:45:48 some notice
Similar Resources

Package for easy logging to logstash http input from microservices

Micro Logger package for easy logging to logstash http input from microservices

Dec 28, 2021

Logging, distilled

What is distillog? distillog aims to offer a minimalistic logging interface that also supports log levels. It takes the stdlib API and only slightly e

Dec 14, 2022

Simple and blazing fast lockfree logging library for golang

Simple and blazing fast lockfree logging library for golang

glg is simple golang logging library Requirement Go 1.11 Installation go get github.com/kpango/glg Example package main import ( "net/http" "time"

Nov 28, 2022

Logging library for Golang

GLO Logging library for Golang Inspired by Monolog for PHP, severity levels are identical Install go get github.com/lajosbencz/glo Severity levels Deb

Sep 26, 2022

The Simplest and worst logging library ever written

gologger A Simple Easy to use go logger library. Displays Colored log into console in any unix or windows platform. You can even store your logs in fi

Sep 26, 2022

Go implementation of systemd Journal's native API for logging

journald Package journald offers Go implementation of systemd Journal's native API for logging. Key features are: based on a connection-less socket wo

Dec 23, 2022

Simple, configurable and scalable Structured Logging for Go.

log Log is a simple, highly configurable, Structured Logging library Why another logging library? There's allot of great stuff out there, but also tho

Sep 26, 2022

LogVoyage - logging SaaS written in GoLang

LogVoyage - logging SaaS written in GoLang

No longer maintained, sorry. Completely rewritten v2 is going to be released soon. Please follow http://github.com/logvoyage LogVoyage - fast and simp

Sep 26, 2022

Structured, composable logging for Go

Structured, composable logging for Go

log15 Package log15 provides an opinionated, simple toolkit for best-practice logging in Go (golang) that is both human and machine readable. It is mo

Dec 18, 2022
This package enables json output, level logging and so on to standard go logger.

logplug This package enables json output, level logging and so on to standard logger. Usage log.SetOutput(logplug.NewJSONPlug(os.Stderr, logplug.LogF

Dec 27, 2021
Gomol is a library for structured, multiple-output logging for Go with extensible logging outputs

gomol Gomol (Go Multi-Output Logger) is an MIT-licensed structured logging library for Go. Gomol grew from a desire to have a structured logging libra

Sep 26, 2022
A simple logging module for go, with a rotating file feature and console logging.

A simple logging module for go, with a rotating file feature and console logging. Installation go get github.com/jbrodriguez/mlog Usage Sample usage W

Dec 14, 2022
FactorLog is a logging infrastructure for Go that provides numerous logging functions for whatever your style may be
FactorLog is a logging infrastructure for Go that provides numerous logging functions for whatever your style may be

FactorLog FactorLog is a fast logging infrastructure for Go that provides numerous logging functions for whatever your style may be. It could easily b

Aug 3, 2022
Simple and configurable Logging in Go, with level, formatters and writers

go-log Logging package similar to log4j for the Golang. Support dynamic log level Support customized formatter TextFormatter JSONFormatter Support mul

Sep 26, 2022
📝 🪵 A minimal level based logging library for Go

slogx A minimal level based logging library for Go. Installation Example Usage Logger Log Level Format Output Contribute License Installation go get g

May 23, 2022
a golang log lib supports level and multi handlers

go-log a golang log lib supports level and multi handlers Use import "github.com/siddontang/go-log/log" //log with different level log.Info("hello wo

Dec 29, 2022
Multi-level logger based on go std log

mlog the mlog is multi-level logger based on go std log. It is: Simple Easy to use NOTHING ELSE package main import ( log "github.com/ccpaging/lo

May 18, 2022
Structured logging package for Go.
Structured logging package for Go.

Package log implements a simple structured logging API inspired by Logrus, designed with centralization in mind. Read more on Medium. Handlers apexlog

Dec 24, 2022
A Go (golang) package providing high-performance asynchronous logging, message filtering by severity and category, and multiple message targets.

ozzo-log Other languages 简体中文 Русский Description ozzo-log is a Go package providing enhanced logging support for Go programs. It has the following fe

Dec 17, 2022