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.

30 lines
608 B

11 years ago
11 years ago
11 years ago
11 years ago
  1. package p2p
  2. import (
  3. "github.com/cihub/seelog"
  4. )
  5. var log seelog.LoggerInterface
  6. func init() {
  7. config := `
  8. <seelog type="asyncloop" minlevel="debug">
  9. <outputs formatid="colored">
  10. <console/>
  11. </outputs>
  12. <formats>
  13. <format id="main" format="%Date/%Time [%LEV] %Msg%n"/>
  14. <format id="colored" format="%Time %EscM(46)%Level%EscM(49) %EscM(36)%File%EscM(39) %Msg%n%EscM(0)"/>
  15. </formats>
  16. </seelog>`
  17. var err error
  18. log, err = seelog.LoggerFromConfigAsBytes([]byte(config))
  19. if err != nil {
  20. panic(err)
  21. }
  22. }
  23. func SetLogger(l seelog.LoggerInterface) {
  24. log = l
  25. }