mirror of
https://github.com/watn3y/steamsalty.git
synced 2025-09-09 09:42:22 +02:00
v1.0
- Fixed SLEEPTIME not working (always 0) - Refined logging - Added metadata to /info command - Bot now automatically sets own commands for autocompletion
This commit is contained in:
parent
d50b026545
commit
6c733c6e41
14 changed files with 116 additions and 53 deletions
22
main.go
22
main.go
|
@ -1,18 +1,19 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/rs/zerolog/log"
|
||||
|
||||
|
||||
"watn3y/steamsalty/config"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Println("Starting SteamSalty...")
|
||||
println("Starting SteamSalty...")
|
||||
|
||||
configureLogger()
|
||||
|
||||
|
@ -23,13 +24,20 @@ func main() {
|
|||
}
|
||||
|
||||
func configureLogger() {
|
||||
|
||||
zerolog.CallerMarshalFunc = func(pc uintptr, file string, line int) string {
|
||||
const prefix = "steamsalty/"
|
||||
|
||||
index := strings.Index(file, prefix)
|
||||
if index != -1 {
|
||||
return file[index+len(prefix):] + ":" + strconv.Itoa(line)
|
||||
}
|
||||
return file + ":" + strconv.Itoa(line)
|
||||
}
|
||||
|
||||
output := zerolog.ConsoleWriter{Out: os.Stdout, TimeFormat: time.DateTime}
|
||||
|
||||
log.Logger = zerolog.New(output).With().Timestamp().Caller().Logger()
|
||||
|
||||
//! note that we overwrite the loglevel after loading the config in config/config.go. This is just the default
|
||||
zerolog.SetGlobalLevel(zerolog.TraceLevel)
|
||||
|
||||
log.Info().Msg("Started Logger")
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue