1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- package discordgo
- import (
- "fmt"
- "log"
- "runtime"
- "strings"
- )
- const (
-
-
- LogError int = iota
-
-
- LogWarning
-
- LogInformational
-
-
- LogDebug
- )
- func msglog(msgL, caller int, format string, a ...interface{}) {
- pc, file, line, _ := runtime.Caller(caller)
- files := strings.Split(file, "/")
- file = files[len(files)-1]
- name := runtime.FuncForPC(pc).Name()
- fns := strings.Split(name, ".")
- name = fns[len(fns)-1]
- msg := fmt.Sprintf(format, a...)
- log.Printf("[DG%d] %s:%d:%s() %s\n", msgL, file, line, name, msg)
- }
- func (s *Session) log(msgL int, format string, a ...interface{}) {
- if msgL > s.LogLevel {
- return
- }
- msglog(msgL, 2, format, a...)
- }
- func (v *VoiceConnection) log(msgL int, format string, a ...interface{}) {
- if msgL > v.LogLevel {
- return
- }
- msglog(msgL, 2, format, a...)
- }
|