Documentation ¶
Index ¶
Constants ¶
View Source
const ( Reset = "\x1b[0m" Black = "\x1b[30m" Red = "\x1b[31m" Green = "\x1b[32m" Yellow = "\x1b[33m" Blue = "\x1b[34m" Magenta = "\x1b[35m" Cyan = "\x1b[36m" White = "\x1b[37m" Gray = "\x1b[90m" )
Color codes for different log levels
Variables ¶
This section is empty.
Functions ¶
func NewLogger ¶
NewLogger creates a new logger for the application, each logger has a file logger and a console logger. The file logger is used to log to the vlogs directory, while the console logger is used to log to the console.
Example:
logger, err := logs.NewLogger(app) if err != nil { fmt.Printf("Error: %v\n", err) return } logger.File.Info().Msg("Batman reached the file logger") logger.Console.Info().Msg("Batman reached the console logger")
since we use structured logging, we can also log with fields:
logger.File.Info().Str("where", "file").Msg("Batman is saving Gotham") logger.Console.Info().Str("where", "console").Msg("Batman is saving Gotham")
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.