mirror of
https://gitea.com/gitea/gitea-mcp.git
synced 2025-10-30 09:51:50 +00:00
refactor: add hot reloading and improve logging functions
- Add command to install `air` for hot reloading in `Makefile`
- Add `dev` command to run the application with hot reload in `Makefile`
- Add `vendor` command to tidy and verify module dependencies in `Makefile`
- Update log synchronization method to use `log.Default().Sync()` in `cmd/cmd.go`
- Change variadic parameter type from `interface{}` to `any` in logging functions
- Remove `Sync` function from `pkg/log/log.go`
ref: https://github.com/uber-go/zap/issues/880
Signed-off-by: appleboy <appleboy.tw@gmail.com>
This commit is contained in:
@@ -71,30 +71,22 @@ func Panic(msg string, fields ...zap.Field) {
|
||||
Default().Panic(msg, fields...)
|
||||
}
|
||||
|
||||
func Debugf(format string, args ...interface{}) {
|
||||
func Debugf(format string, args ...any) {
|
||||
Default().Sugar().Debugf(format, args...)
|
||||
}
|
||||
|
||||
func Infof(format string, args ...interface{}) {
|
||||
func Infof(format string, args ...any) {
|
||||
Default().Sugar().Infof(format, args...)
|
||||
}
|
||||
|
||||
func Warnf(format string, args ...interface{}) {
|
||||
func Warnf(format string, args ...any) {
|
||||
Default().Sugar().Warnf(format, args...)
|
||||
}
|
||||
|
||||
func Errorf(format string, args ...interface{}) {
|
||||
func Errorf(format string, args ...any) {
|
||||
Default().Sugar().Errorf(format, args...)
|
||||
}
|
||||
|
||||
func Fatalf(format string, args ...interface{}) {
|
||||
func Fatalf(format string, args ...any) {
|
||||
Default().Sugar().Fatalf(format, args...)
|
||||
}
|
||||
|
||||
func Sync() {
|
||||
err := defaultLogger.Sync()
|
||||
if err != nil {
|
||||
Error(err.Error())
|
||||
}
|
||||
Info("logger has been synced")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user