mirror of https://github.com/rocboss/paopao-ce
commit
426bb1ff5a
@ -1,11 +0,0 @@
|
||||
package global
|
||||
|
||||
import (
|
||||
"github.com/go-redis/redis/v8"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
var (
|
||||
DBEngine *gorm.DB
|
||||
Redis *redis.Client
|
||||
)
|
@ -1,35 +0,0 @@
|
||||
package global
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"github.com/rocboss/paopao-ce/pkg/setting"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
var (
|
||||
Features *setting.FeaturesSettingS
|
||||
ServerSetting *setting.ServerSettingS
|
||||
AppSetting *setting.AppSettingS
|
||||
MySQLSetting *setting.MySQLSettingS
|
||||
RedisSetting *setting.RedisSettingS
|
||||
SmsJuheSetting *setting.SmsJuheSettings
|
||||
AlipaySetting *setting.AlipaySettingS
|
||||
ZincSetting *setting.ZincSettingS
|
||||
AliOSSSetting *setting.AliOSSSettingS
|
||||
MinIOSetting *setting.MinIOSettingS
|
||||
S3Setting *setting.S3SettingS
|
||||
JWTSetting *setting.JWTSettingS
|
||||
LoggerFileSetting *setting.LoggerFileSettingS
|
||||
LoggerZincSetting *setting.LoggerZincSettingS
|
||||
Logger *logrus.Logger
|
||||
Mutex *sync.Mutex
|
||||
)
|
||||
|
||||
func Cfg(key string) (string, bool) {
|
||||
return Features.Cfg(key)
|
||||
}
|
||||
|
||||
func CfgIf(expression string) bool {
|
||||
return Features.CfgIf(expression)
|
||||
}
|
@ -1,131 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"log"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/go-redis/redis/v8"
|
||||
"github.com/rocboss/paopao-ce/global"
|
||||
"github.com/rocboss/paopao-ce/internal/model"
|
||||
"github.com/rocboss/paopao-ce/internal/routers/api"
|
||||
"github.com/rocboss/paopao-ce/internal/service"
|
||||
"github.com/rocboss/paopao-ce/pkg/logger"
|
||||
"github.com/rocboss/paopao-ce/pkg/setting"
|
||||
"github.com/rocboss/paopao-ce/pkg/zinc"
|
||||
)
|
||||
|
||||
var (
|
||||
noDefaultFeatures bool
|
||||
features suites
|
||||
)
|
||||
|
||||
type suites []string
|
||||
|
||||
func (s *suites) String() string {
|
||||
return strings.Join(*s, ",")
|
||||
}
|
||||
|
||||
func (s *suites) Set(value string) error {
|
||||
for _, item := range strings.Split(value, ",") {
|
||||
*s = append(*s, strings.TrimSpace(item))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
flagParse()
|
||||
|
||||
err := setupSetting()
|
||||
if err != nil {
|
||||
log.Fatalf("init.setupSetting err: %v", err)
|
||||
}
|
||||
|
||||
err = setupLogger()
|
||||
if err != nil {
|
||||
log.Fatalf("init.setupLogger err: %v", err)
|
||||
}
|
||||
|
||||
err = setupDBEngine()
|
||||
if err != nil {
|
||||
log.Fatalf("init.setupDBEngine err: %v", err)
|
||||
}
|
||||
|
||||
client := zinc.NewClient(global.ZincSetting)
|
||||
service.Initialize(global.DBEngine, client)
|
||||
api.Initialize()
|
||||
}
|
||||
|
||||
func setupSetting() error {
|
||||
setting, err := setting.NewSetting()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
global.Features = setting.FeaturesFrom("Features")
|
||||
if len(features) > 0 {
|
||||
if err = global.Features.Use(features, noDefaultFeatures); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
objects := map[string]interface{}{
|
||||
"App": &global.AppSetting,
|
||||
"Server": &global.ServerSetting,
|
||||
"Alipay": &global.AlipaySetting,
|
||||
"SmsJuhe": &global.SmsJuheSetting,
|
||||
"LoggerFile": &global.LoggerFileSetting,
|
||||
"LoggerZinc": &global.LoggerZincSetting,
|
||||
"MySQL": &global.MySQLSetting,
|
||||
"Zinc": &global.ZincSetting,
|
||||
"Redis": &global.RedisSetting,
|
||||
"JWT": &global.JWTSetting,
|
||||
"AliOSS": &global.AliOSSSetting,
|
||||
"MinIO": &global.MinIOSetting,
|
||||
"S3": &global.S3Setting,
|
||||
}
|
||||
if err = setting.Unmarshal(objects); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
global.JWTSetting.Expire *= time.Second
|
||||
global.ServerSetting.ReadTimeout *= time.Second
|
||||
global.ServerSetting.WriteTimeout *= time.Second
|
||||
global.Mutex = &sync.Mutex{}
|
||||
return nil
|
||||
}
|
||||
|
||||
func flagParse() {
|
||||
flag.BoolVar(&noDefaultFeatures, "no-default-features", false, "whether use default features")
|
||||
flag.Var(&features, "features", "use special features")
|
||||
flag.Parse()
|
||||
}
|
||||
|
||||
func setupLogger() error {
|
||||
logger, err := logger.New()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
global.Logger = logger
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// setupDBEngine 暂时只支持MySQL
|
||||
func setupDBEngine() error {
|
||||
var err error
|
||||
global.DBEngine, err = model.NewDBEngine(global.MySQLSetting)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
global.Redis = redis.NewClient(&redis.Options{
|
||||
Addr: global.RedisSetting.Host,
|
||||
Password: global.RedisSetting.Password,
|
||||
DB: global.RedisSetting.DB,
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
@ -0,0 +1,97 @@
|
||||
package conf
|
||||
|
||||
import (
|
||||
"log"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
var (
|
||||
loggerFileSetting *LoggerFileSettingS
|
||||
loggerZincSetting *LoggerZincSettingS
|
||||
mySQLSetting *MySQLSettingS
|
||||
redisSetting *RedisSettingS
|
||||
features *FeaturesSettingS
|
||||
|
||||
ServerSetting *ServerSettingS
|
||||
AppSetting *AppSettingS
|
||||
SmsJuheSetting *SmsJuheSettings
|
||||
AlipaySetting *AlipaySettingS
|
||||
ZincSetting *ZincSettingS
|
||||
AliOSSSetting *AliOSSSettingS
|
||||
MinIOSetting *MinIOSettingS
|
||||
S3Setting *S3SettingS
|
||||
LocalOSSSetting *LocalOSSSettingS
|
||||
JWTSetting *JWTSettingS
|
||||
Logger *logrus.Logger
|
||||
Mutex *sync.Mutex
|
||||
)
|
||||
|
||||
func setupSetting(suite []string, noDefault bool) error {
|
||||
setting, err := NewSetting()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
features = setting.FeaturesFrom("Features")
|
||||
if len(suite) > 0 {
|
||||
if err = features.Use(suite, noDefault); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
objects := map[string]interface{}{
|
||||
"App": &AppSetting,
|
||||
"Server": &ServerSetting,
|
||||
"Alipay": &AlipaySetting,
|
||||
"SmsJuhe": &SmsJuheSetting,
|
||||
"LoggerFile": &loggerFileSetting,
|
||||
"LoggerZinc": &loggerZincSetting,
|
||||
"MySQL": &mySQLSetting,
|
||||
"Zinc": &ZincSetting,
|
||||
"Redis": &redisSetting,
|
||||
"JWT": &JWTSetting,
|
||||
"AliOSS": &AliOSSSetting,
|
||||
"MinIO": &MinIOSetting,
|
||||
"LocalOSS": &LocalOSSSetting,
|
||||
"S3": &S3Setting,
|
||||
}
|
||||
if err = setting.Unmarshal(objects); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
JWTSetting.Expire *= time.Second
|
||||
ServerSetting.ReadTimeout *= time.Second
|
||||
ServerSetting.WriteTimeout *= time.Second
|
||||
Mutex = &sync.Mutex{}
|
||||
return nil
|
||||
}
|
||||
|
||||
func Initialize(suite []string, noDefault bool) {
|
||||
err := setupSetting(suite, noDefault)
|
||||
if err != nil {
|
||||
log.Fatalf("init.setupSetting err: %v", err)
|
||||
}
|
||||
|
||||
setupLogger()
|
||||
|
||||
err = setupDBEngine()
|
||||
if err != nil {
|
||||
log.Fatalf("init.setupDBEngine err: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// Cfg get value by key if exist
|
||||
func Cfg(key string) (string, bool) {
|
||||
return features.Cfg(key)
|
||||
}
|
||||
|
||||
// CfgIf check expression is true. if expression just have a string like
|
||||
// `Sms` is mean `Sms` whether define in suite feature settings. expression like
|
||||
// `Sms = SmsJuhe` is mean whether `Sms` define in suite feature settings and value
|
||||
// is `SmsJuhe``
|
||||
func CfgIf(expression string) bool {
|
||||
return features.CfgIf(expression)
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
package conf
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"time"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
"gopkg.in/natefinch/lumberjack.v2"
|
||||
"gopkg.in/resty.v1"
|
||||
)
|
||||
|
||||
type zincLogIndex struct {
|
||||
Index map[string]string `json:"index"`
|
||||
}
|
||||
|
||||
type zincLogData struct {
|
||||
Time time.Time `json:"time"`
|
||||
Level logrus.Level `json:"level"`
|
||||
Message string `json:"message"`
|
||||
Data logrus.Fields `json:"data"`
|
||||
}
|
||||
|
||||
type zincLogHook struct {
|
||||
host string
|
||||
index string
|
||||
user string
|
||||
password string
|
||||
}
|
||||
|
||||
func (h *zincLogHook) Fire(entry *logrus.Entry) error {
|
||||
index := &zincLogIndex{
|
||||
Index: map[string]string{
|
||||
"_index": h.index,
|
||||
},
|
||||
}
|
||||
indexBytes, _ := json.Marshal(index)
|
||||
|
||||
data := &zincLogData{
|
||||
Time: entry.Time,
|
||||
Level: entry.Level,
|
||||
Message: entry.Message,
|
||||
Data: entry.Data,
|
||||
}
|
||||
dataBytes, _ := json.Marshal(data)
|
||||
|
||||
logStr := string(indexBytes) + "\n" + string(dataBytes) + "\n"
|
||||
client := resty.New()
|
||||
|
||||
if _, err := client.SetDisableWarn(true).R().
|
||||
SetHeader("Content-Type", "application/json").
|
||||
SetBasicAuth(h.user, h.password).
|
||||
SetBody(logStr).
|
||||
Post(h.host); err != nil {
|
||||
fmt.Println(err.Error())
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (h *zincLogHook) Levels() []logrus.Level {
|
||||
return logrus.AllLevels
|
||||
}
|
||||
|
||||
func setupLogger() {
|
||||
Logger = logrus.New()
|
||||
Logger.Formatter = &logrus.JSONFormatter{}
|
||||
|
||||
if CfgIf("LoggerFile") {
|
||||
Logger.Out = &lumberjack.Logger{
|
||||
Filename: loggerFileSetting.SavePath + "/" + loggerFileSetting.FileName + loggerFileSetting.FileExt,
|
||||
MaxSize: 600,
|
||||
MaxAge: 10,
|
||||
LocalTime: true,
|
||||
}
|
||||
} else if CfgIf("LoggerZinc") {
|
||||
Logger.Out = io.Discard
|
||||
Logger.AddHook(&zincLogHook{
|
||||
host: loggerZincSetting.Host,
|
||||
index: loggerZincSetting.Index,
|
||||
user: loggerZincSetting.User,
|
||||
password: loggerZincSetting.Password,
|
||||
})
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package setting
|
||||
package conf
|
||||
|
||||
import (
|
||||
"testing"
|
@ -1,5 +1,5 @@
|
||||
package core
|
||||
|
||||
type AttachmentCheckService interface {
|
||||
Check(cUrl string) error
|
||||
Check(uri string) error
|
||||
}
|
||||
|
@ -0,0 +1,71 @@
|
||||
package dao
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/rocboss/paopao-ce/internal/conf"
|
||||
)
|
||||
|
||||
func newLocalossServent() *localossServant {
|
||||
savePath, err := filepath.Abs(conf.LocalOSSSetting.SavePath)
|
||||
if err != nil {
|
||||
conf.Logger.Fatalf("get localOSS save path err: %v", err)
|
||||
}
|
||||
|
||||
return &localossServant{
|
||||
savePath: savePath + "/" + conf.LocalOSSSetting.Bucket + "/",
|
||||
domain: getOssDomain(),
|
||||
}
|
||||
}
|
||||
|
||||
func (s *localossServant) PutObject(objectKey string, reader io.Reader, objectSize int64, contentType string) (string, error) {
|
||||
saveDir := s.savePath + filepath.Dir(objectKey)
|
||||
err := os.MkdirAll(saveDir, 0750)
|
||||
if err != nil && !os.IsExist(err) {
|
||||
return "", err
|
||||
}
|
||||
|
||||
savePath := s.savePath + objectKey
|
||||
writer, err := os.Create(savePath)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
defer writer.Close()
|
||||
|
||||
written, err := io.Copy(writer, reader)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if written != objectSize {
|
||||
os.Remove(savePath)
|
||||
return "", errors.New("put object not complete")
|
||||
}
|
||||
|
||||
return s.domain + objectKey, nil
|
||||
}
|
||||
|
||||
func (s *localossServant) SignURL(objectKey string, expiredInSec int64) (string, error) {
|
||||
if expiredInSec < 0 {
|
||||
return "", fmt.Errorf("invalid expires: %d, expires must bigger than 0", expiredInSec)
|
||||
}
|
||||
expiration := time.Now().Unix() + expiredInSec
|
||||
|
||||
// Fixed: Just make things simple and simple now so return an veiry simple sign url.
|
||||
// Maybe make another process logic for sign url in future but not now.
|
||||
uri := fmt.Sprintf("%s%s?expired=%d", s.domain, objectKey, expiration)
|
||||
return uri, nil
|
||||
}
|
||||
|
||||
func (s *localossServant) ObjectURL(objetKey string) string {
|
||||
return s.domain + objetKey
|
||||
}
|
||||
|
||||
func (s *localossServant) ObjectKey(objectUrl string) string {
|
||||
return strings.Replace(objectUrl, s.domain, "", -1)
|
||||
}
|
@ -1,24 +1,29 @@
|
||||
package dao
|
||||
|
||||
import (
|
||||
"github.com/rocboss/paopao-ce/global"
|
||||
"github.com/rocboss/paopao-ce/internal/conf"
|
||||
)
|
||||
|
||||
func getOssDomain() string {
|
||||
uri := "https://"
|
||||
if global.CfgIf("AliOSS") {
|
||||
return uri + global.AliOSSSetting.Domain + "/"
|
||||
} else if global.CfgIf("MinIO") {
|
||||
if !global.MinIOSetting.Secure {
|
||||
if conf.CfgIf("AliOSS") {
|
||||
return uri + conf.AliOSSSetting.Domain + "/"
|
||||
} else if conf.CfgIf("MinIO") {
|
||||
if !conf.MinIOSetting.Secure {
|
||||
uri = "http://"
|
||||
}
|
||||
return uri + global.MinIOSetting.Domain + "/" + global.MinIOSetting.Bucket + "/"
|
||||
} else if global.CfgIf("S3") {
|
||||
if !global.S3Setting.Secure {
|
||||
return uri + conf.MinIOSetting.Domain + "/" + conf.MinIOSetting.Bucket + "/"
|
||||
} else if conf.CfgIf("S3") {
|
||||
if !conf.S3Setting.Secure {
|
||||
uri = "http://"
|
||||
}
|
||||
// TODO: will not work well need test in real world
|
||||
return uri + global.S3Setting.Domain + "/" + global.S3Setting.Bucket + "/"
|
||||
return uri + conf.S3Setting.Domain + "/" + conf.S3Setting.Bucket + "/"
|
||||
} else if conf.CfgIf("LocalOSS") {
|
||||
if !conf.LocalOSSSetting.Secure {
|
||||
uri = "http://"
|
||||
}
|
||||
return uri + conf.LocalOSSSetting.Domain + "/oss/" + conf.LocalOSSSetting.Bucket + "/"
|
||||
}
|
||||
return ""
|
||||
return uri + conf.AliOSSSetting.Domain + "/"
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
package internal
|
||||
|
||||
import (
|
||||
"github.com/rocboss/paopao-ce/internal/routers/api"
|
||||
"github.com/rocboss/paopao-ce/internal/service"
|
||||
)
|
||||
|
||||
func Initialize() {
|
||||
service.Initialize()
|
||||
api.Initialize()
|
||||
}
|
@ -1,35 +1,67 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/fatih/color"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/rocboss/paopao-ce/global"
|
||||
"github.com/rocboss/paopao-ce/internal"
|
||||
"github.com/rocboss/paopao-ce/internal/conf"
|
||||
"github.com/rocboss/paopao-ce/internal/routers"
|
||||
"github.com/rocboss/paopao-ce/pkg/util"
|
||||
)
|
||||
|
||||
var (
|
||||
version, buildDate, commitID string
|
||||
|
||||
noDefaultFeatures bool
|
||||
features suites
|
||||
)
|
||||
|
||||
type suites []string
|
||||
|
||||
func (s *suites) String() string {
|
||||
return strings.Join(*s, ",")
|
||||
}
|
||||
|
||||
func (s *suites) Set(value string) error {
|
||||
for _, item := range strings.Split(value, ",") {
|
||||
*s = append(*s, strings.TrimSpace(item))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
flagParse()
|
||||
|
||||
conf.Initialize(features, noDefaultFeatures)
|
||||
internal.Initialize()
|
||||
}
|
||||
|
||||
func flagParse() {
|
||||
flag.BoolVar(&noDefaultFeatures, "no-default-features", false, "whether use default features")
|
||||
flag.Var(&features, "features", "use special features")
|
||||
flag.Parse()
|
||||
}
|
||||
|
||||
func main() {
|
||||
gin.SetMode(global.ServerSetting.RunMode)
|
||||
gin.SetMode(conf.ServerSetting.RunMode)
|
||||
|
||||
router := routers.NewRouter()
|
||||
s := &http.Server{
|
||||
Addr: global.ServerSetting.HttpIp + ":" + global.ServerSetting.HttpPort,
|
||||
Addr: conf.ServerSetting.HttpIp + ":" + conf.ServerSetting.HttpPort,
|
||||
Handler: router,
|
||||
ReadTimeout: global.ServerSetting.ReadTimeout,
|
||||
WriteTimeout: global.ServerSetting.WriteTimeout,
|
||||
ReadTimeout: conf.ServerSetting.ReadTimeout,
|
||||
WriteTimeout: conf.ServerSetting.WriteTimeout,
|
||||
MaxHeaderBytes: 1 << 20,
|
||||
}
|
||||
|
||||
util.PrintHelloBanner(fmt.Sprintf("paopao %s (build:%s %s)", version, commitID, buildDate))
|
||||
fmt.Fprintf(color.Output, "PaoPao service listen on %s\n",
|
||||
color.GreenString(fmt.Sprintf("http://%s:%s", global.ServerSetting.HttpIp, global.ServerSetting.HttpPort)),
|
||||
color.GreenString(fmt.Sprintf("http://%s:%s", conf.ServerSetting.HttpIp, conf.ServerSetting.HttpPort)),
|
||||
)
|
||||
s.ListenAndServe()
|
||||
}
|
||||
|
@ -1,82 +0,0 @@
|
||||
package logger
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"time"
|
||||
|
||||
"github.com/rocboss/paopao-ce/global"
|
||||
"github.com/sirupsen/logrus"
|
||||
"gopkg.in/natefinch/lumberjack.v2"
|
||||
"gopkg.in/resty.v1"
|
||||
)
|
||||
|
||||
type ZincLogIndex struct {
|
||||
Index map[string]string `json:"index"`
|
||||
}
|
||||
|
||||
type ZincLogData struct {
|
||||
Time time.Time `json:"time"`
|
||||
Level logrus.Level `json:"level"`
|
||||
Message string `json:"message"`
|
||||
Data logrus.Fields `json:"data"`
|
||||
}
|
||||
|
||||
type ZincLogHook struct {
|
||||
Fired bool
|
||||
}
|
||||
|
||||
func (hook *ZincLogHook) Fire(entry *logrus.Entry) error {
|
||||
index := &ZincLogIndex{
|
||||
Index: map[string]string{
|
||||
"_index": global.LoggerZincSetting.Index,
|
||||
},
|
||||
}
|
||||
indexBytes, _ := json.Marshal(index)
|
||||
|
||||
data := &ZincLogData{
|
||||
Time: entry.Time,
|
||||
Level: entry.Level,
|
||||
Message: entry.Message,
|
||||
Data: entry.Data,
|
||||
}
|
||||
dataBytes, _ := json.Marshal(data)
|
||||
|
||||
logStr := string(indexBytes) + "\n" + string(dataBytes) + "\n"
|
||||
client := resty.New()
|
||||
|
||||
if _, err := client.SetDisableWarn(true).R().
|
||||
SetHeader("Content-Type", "application/json").
|
||||
SetBasicAuth(global.LoggerZincSetting.User, global.LoggerZincSetting.Password).
|
||||
SetBody(logStr).
|
||||
Post(global.LoggerZincSetting.Host); err != nil {
|
||||
fmt.Println(err.Error())
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (hook *ZincLogHook) Levels() []logrus.Level {
|
||||
return logrus.AllLevels
|
||||
}
|
||||
|
||||
func New() (*logrus.Logger, error) {
|
||||
log := logrus.New()
|
||||
log.Formatter = &logrus.JSONFormatter{}
|
||||
|
||||
if global.CfgIf("LoggerFile") {
|
||||
s := global.LoggerFileSetting
|
||||
log.Out = &lumberjack.Logger{
|
||||
Filename: s.SavePath + "/" + s.FileName + s.FileExt,
|
||||
MaxSize: 600,
|
||||
MaxAge: 10,
|
||||
LocalTime: true,
|
||||
}
|
||||
} else if global.CfgIf("LoggerZinc") {
|
||||
log.Out = io.Discard
|
||||
log.AddHook(&ZincLogHook{})
|
||||
}
|
||||
|
||||
return log, nil
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
{
|
||||
"version": "",
|
||||
"buildTime": ""
|
||||
"version": "3",
|
||||
"buildTime": "2022-06-08 23:29:43"
|
||||
}
|
Loading…
Reference in new issue