el

package module
v0.0.0-...-6f711be Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2021 License: MIT Imports: 7 Imported by: 0

README

EL

⛱A Go log lib.

Feature

  • Simple API.
  • Level logging.
  • Singleton.
  • Multiple Output.

Install

$ go get -u -v github.com/BouncyElf/el

Example

package main

import "github.com/BouncyElf/el"

func main() {
		el.Info("info from el", el.Map{
				"info":"hello, world",
		})
		el.Warn("should not be here")
		el.Panic("panic from el")
}

Doc

Doc Here

Documentation

Overview

el is a Golang log lib. It's simple.

Index

Constants

View Source
const (
	// log level
	DebugL level = iota
	InfoL
	WarnL
	ErrorL
	PanicL
	FatalL
)

Variables

This section is empty.

Functions

func Debug

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

Debug is theLogger's debug method.

func Debugf

func Debugf(format string, args ...interface{})

func Error

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

Error is theLogger's error method.

func Errorf

func Errorf(format string, args ...interface{})

func Fatal

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

Fatal is theLogger's fatal method.

func Fatalf

func Fatalf(format string, args ...interface{})

func Info

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

Info is theLogger's info method.

func Infof

func Infof(format string, args ...interface{})

func Panic

func Panic(msg string, m ...map[string]interface{})

Panic is theLogger's panic method.

func Panicf

func Panicf(format string, args ...interface{})

func SetConf

func SetConf(c *Conf)

SetConf set theLogger's conf.

func Warn

func Warn(msg string, m ...map[string]interface{})

Warn is theLogger's warn method.

func Warnf

func Warnf(format string, args ...interface{})

Types

type Conf

type Conf struct {
	// Prefix is the prefix of a log.
	Prefix string

	// The logs are write to these outputs.
	Outs []io.Writer

	// Value is the value, that every log will include.
	Value map[string]interface{}

	// Format is the log format.
	Format string

	// AddCaller specific should the log add caller.
	AddCaller bool

	// CallerSkip specific the runtime.Caller(skip) skip number.
	CallerSkip int

	// AddTime specific should the log add time.
	AddTime bool

	// TimeFormat specific the log's time format.
	// "unixnano" and "unix" indicates time.UnixNano() and time.Unix()
	TimeFormat string

	// NotPanic specific should the log panic after panic method.
	NotPanic bool

	// NotFatal specific should the log exit after panic method.
	NotFatal bool

	// LowestLevel specific the lowest log level.
	// level less than LowestLevel will not be log.
	LowestLevel level
}

func DefaultConf

func DefaultConf() *Conf

DefaultConf returns the default conf.

type Map

type Map map[string]interface{}

Map is the alias of map[string]interface{}

Jump to

Keyboard shortcuts

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