logger

package
v0.0.0-...-74b72eb Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAliyunLogger

func NewAliyunLogger(config *SlsConfig) log.Logger

func NewDefaultHelper

func NewDefaultHelper(logger log.Logger) *log.Helper

func NewLogger

func NewLogger(config *LogConfig, slsConfig *SlsConfig) log.Logger

func NewLoggerHelper

func NewLoggerHelper(logger log.Logger, module string, path string) *log.Helper

func NewTestLogger

func NewTestLogger() *log.Helper

func Trace

func Trace() log.Valuer

Types

type LogConfig

type LogConfig struct {
	Level          int      `json:"level"`
	Output         string   `json:"output"`
	Formatter      string   `json:"formatter"`
	FileOpen       bool     `json:"fileOpen"`
	FilePath       string   `json:"filePath"`
	ElasticOpen    bool     `json:"elasticOpen"`
	ElasticIndex   string   `json:"elasticIndex"`
	ElasticLevel   string   `json:"elasticLevel"`
	Channel        []string `json:"channel"`
	RequestLog     bool     `json:"requestLog"`
	RequestLogType string   `json:"requestLogType"`
}

type Logger

type Logger interface {
	log.Logger
}

Logger see more detail https://github.com/aliyun/aliyun-log-go-sdk

func NewAliyunLog

func NewAliyunLog(options ...Option) Logger

NewAliyunLog new aliyun logger with options.

type Option

type Option func(alc *options)

func WithAccessKey

func WithAccessKey(ak string) Option

func WithAccessSecret

func WithAccessSecret(as string) Option

func WithEndpoint

func WithEndpoint(endpoint string) Option

func WithLogStore

func WithLogStore(logStore string) Option

func WithProject

func WithProject(project string) Option

func WithRegion

func WithRegion(region string) Option

func WithSource

func WithSource(source string) Option

func WithTopic

func WithTopic(topic string) Option

type SlsConfig

type SlsConfig struct {
	Endpoint        string `json:"endpoint"`
	AccessKey       string `json:"accessKey"`
	AccessKeyId     string `json:"accessKeyId"`
	AccessSecret    string `json:"accessSecret"`
	AccessKeySecret string `json:"accessKeySecret"`
	LogStore        string `json:"logStore"`
	LogStoreName    string `json:"logStoreName,"`
	Region          string `json:"region"`
	Project         string `json:"project"`
	ProjectName     string `json:"projectName"`
}

Jump to

Keyboard shortcuts

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