This commit is contained in:
2024-04-12 13:00:28 +03:00
parent ac84e48d8f
commit f1f5e1b712
13 changed files with 303 additions and 291 deletions

22
app/logger.go Normal file
View File

@@ -0,0 +1,22 @@
package app
import (
"fmt"
"os"
)
func LogString(str string) {
if len(os.Getenv("LOG_FILE")) == 0 {
return
}
f, err := os.OpenFile(os.Getenv("LOG_FILE"), os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
if err != nil {
fmt.Println(err)
}
defer f.Close()
if _, err := f.WriteString(str + "\n"); err != nil {
fmt.Println(err)
}
}