Skip to content

Commit

Permalink
fix logs issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Clivern committed Feb 23, 2023
1 parent 5c76431 commit cf37068
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ var serverCmd = &cobra.Command{
dir, _ := filepath.Split(viper.GetString("app.log.output"))

if !fs.DirExists(dir) {
if err := fs.EnsureDir(dir, 775); err != nil {
if err := fs.EnsureDir(dir, 0775); err != nil {
panic(fmt.Sprintf(
"Directory [%s] creation failed with error: %s",
dir,
Expand Down Expand Up @@ -99,7 +99,11 @@ var serverCmd = &cobra.Command{
log.SetOutput(os.Stdout)
defaultLogger.Output = os.Stdout
} else {
f, _ := os.Create(viper.GetString("app.log.output"))
f, _ := os.OpenFile(
viper.GetString("app.log.output"),
os.O_APPEND|os.O_CREATE|os.O_WRONLY,
0775,
)
log.SetOutput(f)
defaultLogger.Output = f
}
Expand Down

0 comments on commit cf37068

Please sign in to comment.