parrot

package module
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

README

🦜 Parrot

A logging tool based on zap

Installation

go get github.com/s1m0n21/parrot

Quick start

package main

import "github.com/s1m0n21/parrot"

func main() {
	// log to console
	log := parrot.New("a")
	log.Infof("test")
	
	// change log level
	_ = parrot.SetLevel("*", "error")
	
	// log to file
	// log file max size: 100MiB
	// log file max backups: 5
	// log file max age: 7days
	log = parrot.New("b", parrot.OptSetLogFile("b.log", 100, 5, 7))
	log.Infof("test")
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrLoggerNotExist = xerrors.New("logger does not exist")

Functions

func New

func New(system string, opts ...Option) *zap.SugaredLogger

func SetLevel

func SetLevel(system, level string) error

Types

type Option

type Option func(*config)

func OptLevelFromEnv

func OptLevelFromEnv() Option

func OptSetLevel

func OptSetLevel(lvl string) Option

func OptSetLogFile

func OptSetLogFile(filename string, size, backups, age int) Option

func OptWithoutCall added in v1.1.2

func OptWithoutCall() Option

func OptWithoutColor added in v1.1.2

func OptWithoutColor() Option

Jump to

Keyboard shortcuts

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