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.

49 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
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. "fmt"
  8. "github.com/martini-contrib/render"
  9. "github.com/gogits/logs"
  10. "github.com/gogits/gogs/modules/base"
  11. )
  12. var logger *logs.BeeLogger
  13. func init() {
  14. logger = logs.NewLogger(10000)
  15. logger.SetLogger("console", "")
  16. }
  17. func Trace(format string, v ...interface{}) {
  18. logger.Trace(format, v...)
  19. }
  20. func Info(format string, v ...interface{}) {
  21. logger.Info(format, v...)
  22. }
  23. func Error(format string, v ...interface{}) {
  24. logger.Error(format, v...)
  25. }
  26. func Warn(format string, v ...interface{}) {
  27. logger.Warn(format, v...)
  28. }
  29. func Critical(format string, v ...interface{}) {
  30. logger.Critical(format, v...)
  31. }
  32. func Handle(status int, title string, data base.TmplData, r render.Render, err error) {
  33. data["ErrorMsg"] = err
  34. Error("%s: %v", title, err)
  35. r.HTML(status, fmt.Sprintf("status/%d", status), data)
  36. }