adds structs for all logging features
This commit is contained in:
17
logging.go
17
logging.go
@@ -6,6 +6,7 @@ import (
|
||||
"log/slog"
|
||||
"os"
|
||||
"regexp"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func New(c Customization) {
|
||||
@@ -88,7 +89,7 @@ func SetNumericLevel(level int) {
|
||||
|
||||
func setDefaults(c *Customization) error {
|
||||
// \/ \/ \/ REQUIRED FIELDS \/ \/ \/ //
|
||||
|
||||
|
||||
// format, can be one of "json" or "text"
|
||||
switch {
|
||||
case len(c.Format) == 0:
|
||||
@@ -124,14 +125,12 @@ func setDefaults(c *Customization) error {
|
||||
return errors.New("Invalid application id, must be a valid uuid string.")
|
||||
}
|
||||
|
||||
|
||||
|
||||
// /\ /\ /\ REQUIRED FIELDS /\ /\ /\ //
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func Fatal(msg string, attrs ...interface{}) {
|
||||
func Fatal(operation, correlationID, msg string, attrs ...interface{}) {
|
||||
L.Log.Log(
|
||||
L.Ctx,
|
||||
LevelFatal,
|
||||
@@ -140,7 +139,7 @@ func Fatal(msg string, attrs ...interface{}) {
|
||||
)
|
||||
}
|
||||
|
||||
func Error(msg string, attrs ...interface{}) {
|
||||
func Error(operation, correlationID, msg string, attrs ...interface{}) {
|
||||
L.Log.Log(
|
||||
L.Ctx,
|
||||
slog.LevelError,
|
||||
@@ -149,7 +148,7 @@ func Error(msg string, attrs ...interface{}) {
|
||||
)
|
||||
}
|
||||
|
||||
func Warn(msg string, attrs ...interface{}) {
|
||||
func Warn(operation, correlationID, msg string, attrs ...interface{}) {
|
||||
L.Log.Log(
|
||||
L.Ctx,
|
||||
slog.LevelWarn,
|
||||
@@ -158,7 +157,7 @@ func Warn(msg string, attrs ...interface{}) {
|
||||
)
|
||||
}
|
||||
|
||||
func Info(msg string, attrs ...interface{}) {
|
||||
func Info(operation, correlationID, msg string, attrs ...interface{}) {
|
||||
L.Log.Log(
|
||||
L.Ctx,
|
||||
slog.LevelInfo,
|
||||
@@ -167,7 +166,7 @@ func Info(msg string, attrs ...interface{}) {
|
||||
)
|
||||
}
|
||||
|
||||
func Debug(msg string, attrs ...interface{}) {
|
||||
func Debug(operation, correlationID, msg string, attrs ...interface{}) {
|
||||
L.Log.Log(
|
||||
L.Ctx,
|
||||
slog.LevelDebug,
|
||||
@@ -176,7 +175,7 @@ func Debug(msg string, attrs ...interface{}) {
|
||||
)
|
||||
}
|
||||
|
||||
func Trace(msg string, attrs ...interface{}) {
|
||||
func Trace(operation, correlationID, msg string, attrs ...interface{}) {
|
||||
L.Log.Log(
|
||||
L.Ctx,
|
||||
LevelTrace,
|
||||
|
Reference in New Issue
Block a user