05_custom_logger

command
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2025 License: MIT Imports: 4 Imported by: 0

README

自定义日志示例

展示如何实现自定义日志记录器。

功能

  • 实现 Logger 接口
  • 自定义日志格式
  • 设置日志大小限制

运行

go run main.go

测试

# 测试 GET
curl http://localhost:8080/hello

# 测试 POST(会记录日志)
curl -X POST http://localhost:8080/test \
  -H "Content-Type: application/json" \
  -d '{"key":"value","data":"test"}'

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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