use logx
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 15m24s

This commit is contained in:
2025-06-06 23:12:49 +08:00
parent b1934579c0
commit 9fa26bc026
3 changed files with 17 additions and 4 deletions

View File

@ -26,3 +26,14 @@ CategoryRpc:
Key: category.rpc Key: category.rpc
BucketName: gallery BucketName: gallery
Log:
ServiceName: gallery-rpc-service
Mode: console # 日志输出模式,支持 console 和 file
Encoding: plain # 日志格式,支持 json 和 plain
Path: ./logs
Level: debug # 日志等级,支持 debug,info,error,severe
MaxSize: 10 # MB
KeepDays: 30 # 天
MaxBackups: 3
Compress: false

View File

@ -2,7 +2,6 @@ package main
import ( import (
"flag" "flag"
"fmt"
"godemo/gallery/gallery" "godemo/gallery/gallery"
"godemo/gallery/internal/config" "godemo/gallery/internal/config"
@ -10,6 +9,7 @@ import (
"godemo/gallery/internal/svc" "godemo/gallery/internal/svc"
"github.com/zeromicro/go-zero/core/conf" "github.com/zeromicro/go-zero/core/conf"
"github.com/zeromicro/go-zero/core/logx"
"github.com/zeromicro/go-zero/core/service" "github.com/zeromicro/go-zero/core/service"
"github.com/zeromicro/go-zero/zrpc" "github.com/zeromicro/go-zero/zrpc"
"google.golang.org/grpc" "google.golang.org/grpc"
@ -34,6 +34,6 @@ func main() {
}) })
defer s.Stop() defer s.Stop()
fmt.Printf("Starting rpc server at %s...\n", c.ListenOn) logx.Infof("Starting rpc server at %s...", c.ListenOn)
s.Start() s.Start()
} }

View File

@ -1,6 +1,8 @@
package config package config
import "github.com/zeromicro/go-zero/zrpc" import (
"github.com/zeromicro/go-zero/zrpc"
)
type Config struct { type Config struct {
zrpc.RpcServerConf zrpc.RpcServerConf