Popularity
1.4
Declining
Activity
0.0
Stable
9
2
2

Programming language: Go
Tags: Logging    

logdump alternatives and similar packages

Based on the "Logging" category

Do you think we are missing an alternative of logdump or a related project?

Add another 'Logging' Package

README

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