log.go 273 B

123456789101112131415161718
  1. package common
  2. import (
  3. "log"
  4. )
  5. var logger *log.Logger
  6. func GetLog(prefix string) *log.Logger {
  7. initLog(prefix)
  8. return logger
  9. }
  10. func initLog(prefix string) {
  11. logger = log.Default()
  12. logger.SetFlags(log.Llongfile | log.Ltime | log.Ldate)
  13. logger.SetPrefix(prefix)
  14. }