file.go 441 B

123456789101112131415161718192021
  1. package logger
  2. import (
  3. "fmt"
  4. "os"
  5. "time"
  6. )
  7. // getLogFilePath get the log file save path
  8. func getLogFilePath() string {
  9. return fmt.Sprintf("%s%s", os.Getenv("RUNTIME_ROOT_PATH"), os.Getenv("LOG_SAVE_PATH"))
  10. }
  11. // getLogFileName get the save name of the log file
  12. func getLogFileName() string {
  13. return fmt.Sprintf("%s%s.%s",
  14. os.Getenv("LOG_SAVE_NAME"),
  15. time.Now().Format(os.Getenv("TIME_FORMAT")),
  16. os.Getenv("LOG_FILE_EXT"),
  17. )
  18. }