diff --git a/gallery/etc/gallery.yaml b/gallery/etc/gallery.yaml index f57f4df..ecc7261 100644 --- a/gallery/etc/gallery.yaml +++ b/gallery/etc/gallery.yaml @@ -25,4 +25,15 @@ CategoryRpc: - 127.0.0.1:2379 Key: category.rpc -BucketName: gallery \ No newline at end of file +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 diff --git a/gallery/gallery.go b/gallery/gallery.go index c67c740..823f751 100644 --- a/gallery/gallery.go +++ b/gallery/gallery.go @@ -2,7 +2,6 @@ package main import ( "flag" - "fmt" "godemo/gallery/gallery" "godemo/gallery/internal/config" @@ -10,6 +9,7 @@ import ( "godemo/gallery/internal/svc" "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/zrpc" "google.golang.org/grpc" @@ -34,6 +34,6 @@ func main() { }) defer s.Stop() - fmt.Printf("Starting rpc server at %s...\n", c.ListenOn) + logx.Infof("Starting rpc server at %s...", c.ListenOn) s.Start() } diff --git a/gallery/internal/config/config.go b/gallery/internal/config/config.go index 96d19ec..a83a238 100644 --- a/gallery/internal/config/config.go +++ b/gallery/internal/config/config.go @@ -1,6 +1,8 @@ package config -import "github.com/zeromicro/go-zero/zrpc" +import ( + "github.com/zeromicro/go-zero/zrpc" +) type Config struct { zrpc.RpcServerConf