Initial commit: Эфир мессенджер

This commit is contained in:
2026-04-06 14:57:36 +03:00
commit ff93679b6d
50 changed files with 5642 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
package logger
import (
"log/slog"
"os"
)
var Log *slog.Logger
func Init(environment string) {
var handler slog.Handler
if environment == "production" {
handler = slog.NewJSONHandler(os.Stdout, &slog.HandlerOptions{
Level: slog.LevelInfo,
})
} else {
handler = slog.NewTextHandler(os.Stdout, &slog.HandlerOptions{
Level: slog.LevelDebug,
})
}
Log = slog.New(handler)
slog.SetDefault(Log)
}
func Info(msg string, args ...any) {
Log.Info(msg, args...)
}
func Debug(msg string, args ...any) {
Log.Debug(msg, args...)
}
func Error(msg string, args ...any) {
Log.Error(msg, args...)
}
func Warn(msg string, args ...any) {
Log.Warn(msg, args...)
}