You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.0 KiB

10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
  1. // Copyright 2014 The Gogs Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. // Package log is a wrapper of logs for short calling name.
  5. package log
  6. import (
  7. "github.com/gogits/logs"
  8. )
  9. var (
  10. logger *logs.BeeLogger
  11. Mode, Config string
  12. )
  13. func init() {
  14. NewLogger(0, "console", `{"level": 0}`)
  15. }
  16. func NewLogger(bufLen int64, mode, config string) {
  17. Mode, Config = mode, config
  18. logger = logs.NewLogger(bufLen)
  19. logger.SetLogFuncCallDepth(3)
  20. logger.SetLogger(mode, config)
  21. }
  22. func Trace(format string, v ...interface{}) {
  23. logger.Trace(format, v...)
  24. }
  25. func Debug(format string, v ...interface{}) {
  26. logger.Debug(format, v...)
  27. }
  28. func Info(format string, v ...interface{}) {
  29. logger.Info(format, v...)
  30. }
  31. func Error(format string, v ...interface{}) {
  32. logger.Error(format, v...)
  33. }
  34. func Warn(format string, v ...interface{}) {
  35. logger.Warn(format, v...)
  36. }
  37. func Critical(format string, v ...interface{}) {
  38. logger.Critical(format, v...)
  39. }