Commit e65ffd2e authored by 贾浩@五瓣科技's avatar 贾浩@五瓣科技

update dockerfile

parent 418a0713
Pipeline #790 canceled with stages
...@@ -2,6 +2,8 @@ package main ...@@ -2,6 +2,8 @@ package main
import ( import (
"flag" "flag"
"io"
"os"
"sdk_api/config" "sdk_api/config"
"sdk_api/dao" "sdk_api/dao"
messager "sdk_api/messenger" messager "sdk_api/messenger"
...@@ -11,14 +13,19 @@ import ( ...@@ -11,14 +13,19 @@ import (
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
) )
func init() { func initLog() {
file, _ := os.OpenFile("log", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666)
mw := io.MultiWriter(os.Stdout, file)
log.SetOutput(mw)
log.SetFormatter(&log.TextFormatter{ log.SetFormatter(&log.TextFormatter{
FullTimestamp: true, FullTimestamp: true,
}) })
} }
func main() { func main() {
initLog()
flag.Parse() flag.Parse()
cfg, err := config.New() cfg, err := config.New()
if err != nil { if err != nil {
panic(err) panic(err)
......
...@@ -2,6 +2,8 @@ package main ...@@ -2,6 +2,8 @@ package main
import ( import (
"flag" "flag"
"io"
"os"
"sdk_api/config" "sdk_api/config"
"sdk_api/dao" "sdk_api/dao"
messager "sdk_api/messenger" messager "sdk_api/messenger"
...@@ -9,14 +11,19 @@ import ( ...@@ -9,14 +11,19 @@ import (
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
) )
func init() { func initLog() {
file, _ := os.OpenFile("log", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666)
mw := io.MultiWriter(os.Stdout, file)
log.SetOutput(mw)
log.SetFormatter(&log.TextFormatter{ log.SetFormatter(&log.TextFormatter{
FullTimestamp: true, FullTimestamp: true,
}) })
} }
func main() { func main() {
initLog()
flag.Parse() flag.Parse()
cfg, err := config.New() cfg, err := config.New()
if err != nil { if err != nil {
panic(err) panic(err)
......
...@@ -15,6 +15,7 @@ services: ...@@ -15,6 +15,7 @@ services:
volumes: volumes:
- ./conf/tg-messenger/config.toml:/config.toml - ./conf/tg-messenger/config.toml:/config.toml
- ./data/tg-messenger/api.log:/app/log
command: command:
- "/bin/sh" - "/bin/sh"
- "-c" - "-c"
...@@ -32,6 +33,7 @@ services: ...@@ -32,6 +33,7 @@ services:
volumes: volumes:
- ./conf/tg-messenger/config.toml:/config.toml - ./conf/tg-messenger/config.toml:/config.toml
- ./data/tg-messenger/messenger.log:/app/log
command: command:
- "/bin/sh" - "/bin/sh"
- "-c" - "-c"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment