Help us shape the future of Go! Take the 2026 Go Developer Survey

postlog

package
v2.0.11 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const MongoSinkName = "mongodb"

MongoSinkName 内置 MongoDB 落库 handler 的注册名。

Variables

This section is empty.

Functions

func Close added in v2.0.5

func Close()

Close 停止全部日志处理器并尽力排空队列,进程退出前调用(mgin.SafeExit 已内置调用)。

func RegisterHandler added in v2.0.5

func RegisterHandler(h logsink.Handler, opts ...logsink.Option) error

RegisterHandler 挂接一个接口日志处理器,等价于 logsink.Register。 外部插件(mgkafka、elasticsearch 插件等)或业务代码在应用启动时调用即可接收全量接口日志。

postlog.RegisterHandler(logsink.NewHandlerFunc("kafka", func(e *logsink.Entry) error {
    return mgkafka.Kafka.Send(topic, utils.ToJSON(e))
}))

func RequestLogger

func RequestLogger() gin.HandlerFunc

Types

This section is empty.

Jump to

Keyboard shortcuts

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