log

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2021 License: Apache-2.0 Imports: 8 Imported by: 11

Documentation

Overview

Example
package main

import (
	"gitee.com/aarlin/leaflet/log"
	l "log"
)

func main() {
	name := "Leaf"

	log.Debug("My name is %v", name)
	log.Release("My name is %v", name)
	log.Error("My name is %v", name)
	// log.Fatal("My name is %v", name)

	logger, err := log.New("release", "", l.LstdFlags)
	if err != nil {
		return
	}
	defer logger.Close()

	logger.Debug("will not print")
	logger.Release("My name is %v", name)

	log.Export(logger)

	log.Debug("will not print")
	log.Release("My name is %v", name)
}
Output:

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close()

func Debug

func Debug(keyvals ...interface{})

func DebugF

func DebugF(format string, a ...interface{})

func Error

func Error(keyvals ...interface{})

func ErrorF

func ErrorF(format string, a ...interface{})

func Export

func Export(logger *Logger)

It's dangerous to call the method on logging

func Fatal

func Fatal(keyvals ...interface{})

func FatalF

func FatalF(format string, a ...interface{})

func Release

func Release(keyvals ...interface{})

func ReleaseF

func ReleaseF(format string, a ...interface{})

Types

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

func New

func New(strLevel string, pathname string, fileNamePrefix string, keepHour int, flag int) (*Logger, error)

func (*Logger) Close

func (logger *Logger) Close()

It's dangerous to call the method on logging

func (*Logger) Debug

func (logger *Logger) Debug(keyvals ...interface{})

func (*Logger) Error

func (logger *Logger) Error(keyvals ...interface{})

func (*Logger) Fatal

func (logger *Logger) Fatal(keyvals ...interface{})

func (*Logger) Release

func (logger *Logger) Release(keyvals ...interface{})

Jump to

Keyboard shortcuts

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