Skip to content

Releases: azhai/gozzo

v1.4.2

03 Jul 05:40
Compare
Choose a tag to compare

调整配置文件读取方式

24 Feb 13:57
Compare
Choose a tag to compare
  1. 调整配置文件读取方式
  2. 修复日志路径解析问题
  3. 升级依赖库

单例日志和xorm及gorm日志适配器

07 Jul 00:12
Compare
Choose a tag to compare

单例日志和xorm及gorm日志适配器

两个功能:rotate日志;go代码美化。

06 Jul 07:01
Compare
Choose a tag to compare

文件日志 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