67 lines
2.2 KiB
Go
67 lines
2.2 KiB
Go
// Package l4g provides logging functionality for the application.
|
|
//
|
|
// This package implements two separate logging systems:
|
|
//
|
|
// # MAIN LOGGER
|
|
//
|
|
// The main logger is configurable via the LOGGER_TYPE environment variable
|
|
// and is used for structured application logging:
|
|
//
|
|
// - LOGGER_TYPE="terminal" - Outputs to stdout with formatted messages
|
|
// - LOGGER_TYPE="file" - Writes to a log file (default: ./app.log)
|
|
// - LOGGER_TYPE="database" - Stores structured log entries in the database
|
|
//
|
|
// Use the main logger for:
|
|
// - User activities and business logic events
|
|
// - Error logging and exception handling
|
|
// - Audit trails and security events
|
|
// - System state changes
|
|
//
|
|
// Example usage:
|
|
//
|
|
// l4g.Init(config.GetConfig().LoggerType)
|
|
// entry := model.LogEntry{
|
|
// LogType: l4g.LOG_TYPE_USER,
|
|
// Severity: l4g.SEVERITY_INFO,
|
|
// Content: &message,
|
|
// }
|
|
// l4g.Write(entry)
|
|
//
|
|
// # DEBUG LOGGER
|
|
//
|
|
// The debug logger is completely separate and always outputs to terminal,
|
|
// regardless of the main logger configuration. It's used for development
|
|
// and initialization messages that should always be visible:
|
|
//
|
|
// - Program initialization and startup messages
|
|
// - Development debugging and troubleshooting
|
|
// - Server configuration and status information
|
|
//
|
|
// Use the debug logger for:
|
|
// - Package initialization messages
|
|
// - Server startup and configuration
|
|
// - Development debugging (temporary print statements)
|
|
// - System health checks during startup
|
|
//
|
|
// Example usage:
|
|
//
|
|
// l4g.DebugInit("Initializing database connection")
|
|
// l4g.DebugServer("Server listening on port 8080")
|
|
// l4g.Debug("Temporary debug message")
|
|
//
|
|
// # LOG TYPES AND SEVERITY LEVELS
|
|
//
|
|
// Log Types:
|
|
// - LOG_TYPE_SYSTEM: System-level events and operations
|
|
// - LOG_TYPE_USER: User activities and interactions
|
|
// - LOG_TYPE_ORG: Organization-level events
|
|
// - LOG_TYPE_AUDIT: Security and compliance events
|
|
//
|
|
// Severity Levels:
|
|
// - SEVERITY_DEBUG: Development and troubleshooting information
|
|
// - SEVERITY_INFO: General informational messages
|
|
// - TYPE_WARN: Warning conditions that should be noted
|
|
// - SEVERITY_ERROR: Error conditions that affect functionality
|
|
// - SEVERITY_FATAL: Critical errors that cause program termination
|
|
package l4g
|