remove sentry and move to slog
This commit is contained in:
parent
a20bc22ab1
commit
5d2b8f39d9
18 changed files with 134 additions and 232 deletions
|
@ -4,10 +4,9 @@ import (
|
|||
"github.com/disgoorg/disgo"
|
||||
"github.com/disgoorg/disgo/bot"
|
||||
"github.com/disgoorg/disgo/cache"
|
||||
"github.com/disgoorg/log"
|
||||
"github.com/disgoorg/snowflake/v2"
|
||||
"golang.org/x/exp/slog"
|
||||
"io"
|
||||
"log/slog"
|
||||
"net/http"
|
||||
"os"
|
||||
"strings"
|
||||
|
@ -18,21 +17,24 @@ var (
|
|||
avatarCache map[snowflake.ID][]byte
|
||||
)
|
||||
|
||||
var logger = slog.New(slog.NewJSONHandler(os.Stdout, nil))
|
||||
|
||||
func init() {
|
||||
avatarCache = make(map[snowflake.ID][]byte)
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
||||
logger.Info("starting dealsbot...")
|
||||
|
||||
mux := http.NewServeMux()
|
||||
|
||||
client, err := disgo.New(token, bot.WithCacheConfigOpts(
|
||||
cache.WithCaches(
|
||||
cache.FlagsAll,
|
||||
),
|
||||
),
|
||||
client, err := disgo.New(token,
|
||||
bot.WithCacheConfigOpts(
|
||||
cache.WithCaches(cache.FlagsAll)),
|
||||
)
|
||||
if err != nil {
|
||||
slog.Error(err.Error())
|
||||
logger.Error("error initializing disgo client", slog.Any("error", err))
|
||||
return
|
||||
}
|
||||
rest := client.Rest()
|
||||
|
@ -71,5 +73,6 @@ func main() {
|
|||
return
|
||||
})
|
||||
|
||||
log.Fatal(http.ListenAndServe(":8080", mux))
|
||||
err = http.ListenAndServe(":8080", mux)
|
||||
logger.Error("error from http listener", slog.Any("error", err))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue