logger

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2026 License: MIT Imports: 0 Imported by: 0

README

Logger

logger 包定义了基础的日志级别类型。

内容

LogLevel

定义了日志级别字符串类型:

  • Info:信息(info
  • Error:错误(error
  • Success:成功(success
使用示例
import "github.com/fireflycore/go-micro/logger"

func Log(level logger.LogLevel, msg string) {
	_ = level
	_ = msg
}

Documentation

Overview

Package logger 定义 go-micro 的基础日志级别类型。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessLogger added in v0.8.3

type AccessLogger struct {
	Method   uint32 `json:"method"`
	Path     string `json:"path"`
	Request  string `json:"request"`
	Response string `json:"response"`
	Duration uint64 `json:"duration"`
	Status   uint32 `json:"status"`

	ClientIp        string `json:"client_ip"`
	SourceIp        string `json:"source_ip"`
	SourceIpAddress string `json:"source_ip_address"`

	ClientType    uint32 `json:"client_type"`
	ClientName    string `json:"client_name"`
	ClientVersion string `json:"client_version"`

	SystemType    uint32 `json:"system_type"`
	SystemName    string `json:"system_name"`
	SystemVersion string `json:"system_version"`
	AppVersion    string `json:"app_version"`

	InvokeServiceAppId    string `json:"invoke_service_app_id"`
	InvokeServiceEndpoint string `json:"invoke_service_endpoint"`
	TargetServiceAppId    string `json:"target_service_app_id"`
	TargetServiceEndpoint string `json:"target_service_endpoint"`

	TraceId  string `json:"trace_id"`
	ParentId string `json:"parent_id"`
	SpanId   string `json:"span_id"`

	UserId   string `json:"user_id"`
	AppId    string `json:"app_id"`
	TenantId string `json:"tenant_id"`
}

AccessLogger 表示访问日志。

type LogLevel

type LogLevel uint32

LogLevel 定义日志级别枚举。

const (
	Info  LogLevel = 1 // Info 普通级别。
	Warn  LogLevel = 2 // Warn 警告级别。
	Error LogLevel = 3 // Error 错误级别。
)

type OperationLogger added in v0.9.1

type OperationLogger struct {
	Database  string `json:"database"`
	Statement string `json:"statement"`
	Result    string `json:"result"`
	Path      string `json:"path"`

	Duration uint64 `json:"duration"`

	Level uint32 `json:"level"`
	Type  uint32 `json:"type"`

	TraceId  string `json:"trace_id"`
	ParentId string `json:"parent_id"`

	UserId      string `json:"user_id"`
	TargetAppId string `json:"target_app_id"`
	InvokeAppId string `json:"invoke_app_id"`
}

OperationLogger 表示操作日志。

type ServerLogger added in v0.9.1

type ServerLogger struct {
	Path    string `json:"path"`
	Level   uint32 `json:"level"`
	Content string `json:"content"`

	TraceId  string `json:"trace_id"`
	ParentId string `json:"parent_id"`

	UserId string `json:"user_id"`
	AppId  string `json:"app_id"`
}

ServerLogger 表示服务端日志。

Jump to

Keyboard shortcuts

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