Releases: azhai/gozzo
Releases · azhai/gozzo
v1.4.2
Full Changelog: v1.4.0...v1.4.2
调整配置文件读取方式
- 调整配置文件读取方式
- 修复日志路径解析问题
- 升级依赖库
单例日志和xorm及gorm日志适配器
单例日志和xorm及gorm日志适配器
两个功能:rotate日志;go代码美化。
文件日志 logging
package main
import (
"math"
"time"
"github.com/azhai/gozzo/logging"
)
// CalcAge 计算年龄
func CalcAge(birthday string) int {
birth, err := time.Parse("2006-01-02", birthday)
if err != nil {
return -1
}
hours := time.Since(birth).Hours()
return int(math.Round(hours / 24 / 365.25))
}
func main() {
birthday := "1996-02-29"
age := CalcAge(birthday)
logger := logging.NewLoggerURL("debug", "stdout") // 输出到屏幕
logger.Infof("I was born on %s, I am %d years old.", birthday, age)
}
go代码美化 rewrite
➜ make && ./bin/rew -h
#/usr/local/go/bin/go clean
rm -f ./bin/*
Clean all.
Compile rew ...
GOOS=darwin GOARCH=amd64 GOAMD64=v3 CGO_ENABLED=1 /usr/local/go/bin/go build -ldflags="-s -w" -o ./bin/rew ./cmd/rew
Build success.
Version: v1.3.7
Usage: rew [flags] [dir ...]
-v display more information