log

package
v0.0.0-...-e5591e2 Latest Latest
Warning

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

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

README

log

log 目前最低级别是 debug,可以通过 LOG_LEVEL 环境变量或者配置项指定。

log 会记录上下文信息,所以需要传入一个 ctx 才能获取 log 实例。

示例

import "github.com/go-kiss/sniper/pkg/log"

log.Get(ctx).Errorf("1 + 2 = %d", 1 + 2)
log.Errorf(ctx, "1 + 2 = %d", 1 + 2)

Documentation

Overview

Package log 基础日志组件

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(ctx context.Context, args ...interface{})

func Debugf

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

func Error

func Error(ctx context.Context, args ...interface{})

func Errorf

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

func Fatal

func Fatal(ctx context.Context, args ...interface{})

func Fatalf

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

func Info

func Info(ctx context.Context, args ...interface{})

func Infof

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

func PP

func PP(args ...interface{})

PP 类似 PHP 的 var_dump

func Panic

func Panic(ctx context.Context, args ...interface{})

func Panicf

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

func Reset

func Reset()

Reset 使用最新配置重置日志级别

func Trace

func Trace(ctx context.Context, args ...interface{})

func Tracef

func Tracef(ctx context.Context, format string, args ...interface{})

func Warn

func Warn(ctx context.Context, args ...interface{})

func Warnf

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

Types

type Fields

type Fields = logrus.Fields

Fields fields

type Logger

type Logger = *logrus.Entry

Logger logger

func Get

func Get(ctx context.Context) Logger

Get 获取日志实例

Jump to

Keyboard shortcuts

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