log

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package log 提供AIDI PDT后端服务统一的日志接入

根据服务的运行环境自动设置日志级别 自动添加必要的日志字段

Index

Constants

View Source
const (
	Reset  = "\x1b[0m"
	Red    = "\x1b[31m"
	Yellow = "\x1b[33m"
	Green  = "\x1b[32m"
)

Variables

View Source
var ConsoleLogger = Logger{Level: logrus.InfoLevel}

Functions

func Debug

func Debug(v ...interface{})

func Debugf

func Debugf(format string, v ...interface{})

func Error

func Error(v ...interface{})

func Info

func Info(v ...interface{})

func Infof

func Infof(format string, v ...interface{})

func Init

func Init()

Init 初始化日志系统 本地或开发环境设置日志级别为debug,其他环境设置日志级别为info

func SetLevel

func SetLevel(level logrus.Level)

Types

type Entry

type Entry = *logrus.Entry

Entry 单个日志实例

func Get

func Get(ctx context.Context) Entry

Get 获取日志实例并打印

func GetAll

func GetAll(ctx context.Context) Entry

GetAll 获取所有的日志字段

func GetAudit

func GetAudit(ctx context.Context) Entry

GetAudit 获取审计日志实例并打印

type Fields

type Fields = logrus.Fields

Fields 单个日志信息中的单个字段

type Level

type Level int

type Logger

type Logger struct {
	Level logrus.Level
}

Jump to

Keyboard shortcuts

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