jlog

package module
v0.0.0-...-34b77dc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 19, 2019 License: MIT Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

jlog

Basic JSON logger

How to Use

Without Fields
import log "github.com/alwaysbespoke/jlog"

log.Log(log.INFO, "Insert message", nil)
With Fields
import log "github.com/alwaysbespoke/jlog"

log.Log(log.INFO, "Insert message", log.Fields{
    "fieldName":"fieldData",
})
Sample Output
2019/07/18 10:52:57 {"src":<source file path string>,"fname":<function name string>,"type":<level string>,"message":<message string>,"data":{}}
Levels

INFO

ERROR

WARNING

DEBUG

TRACE

INIT

FATAL

Documentation

Index

Constants

View Source
const (
	INFO    = "info"
	ERROR   = "error"
	WARNING = "warning"
	DEBUG   = "debug"
	TRACE   = "trace"
	INIT    = "Init"
	FATAL   = "fatal"
)

Variables

This section is empty.

Functions

func Debug

func Debug(msg string, data map[string]interface{})

func Error

func Error(msg string, data map[string]interface{})

func Fatal

func Fatal(msg string, data map[string]interface{})

func Info

func Info(msg string, data map[string]interface{})

func Log

func Log(msgType string, msg string, data map[string]interface{})

func Trace

func Trace(msg string, data map[string]interface{})

func Warning

func Warning(msg string, data map[string]interface{})

Types

type Fields

type Fields map[string]interface{}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL