logn

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2019 License: MIT Imports: 10 Imported by: 6

README

logn

A wrap of zap, maybe a simplified log4j for golang.

Installation

go get -u github.com/shanexu/logn

Quick Start

Logn loads configuration file from system environment virable LOGN_CONFIG. If the variable is unset, then Logn will try to load the configuration file from current work directory, the file name is "logn.yaml" or "logn.yml".

appenders:
  console:
    - name: CONSOLE
      target: stdout
      encoder:
        console:
  file:
    - name: FILE
      file_name: /tmp/app.log
      encoder:
        json:
    - name: METRICS
      file_name: /tmp/metrics.log
      encoder:
        json:
loggers:
  root:
    level: info
    appender_refs:
      - CONSOLE
  logger:
    - name: helloworld
      appender_refs:
        - CONSOLE
        - FILE
      level: debug

sample code:

package main

import "github.com/shanexu/logn"

func main() {
	helloWorld := logn.GetLogger("helloworld")
	helloWorld.Info("hello, shane!")

	some := logn.GetLogger("some")
	some.Infof("hello, %s", "shane")
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLogger

func GetLogger(name string) core.Logger

func Sync

func Sync()

Types

This section is empty.

Jump to

Keyboard shortcuts

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