log

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: May 31, 2023 License: Apache-2.0 Imports: 7 Imported by: 5

README

log

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

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

示例

import "github.com/learninto/goutil/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 added in v1.3.2

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

func Debugf added in v1.3.2

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

func Error added in v1.3.2

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

func Errorf added in v1.3.2

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

func Fatal added in v1.3.2

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

func Fatalf added in v1.3.2

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

func Info added in v1.3.2

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

func Infof added in v1.3.2

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

func PP

func PP(args ...interface{})

PP 类似 PHP 的 var_dump

func Panic added in v1.3.2

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

func Panicf added in v1.3.2

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

func Reset

func Reset()

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

func Trace added in v1.3.2

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

func Tracef added in v1.3.2

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

func Warn added in v1.3.2

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

func Warnf added in v1.3.2

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