Updated hlog documentation to comply with GOLIB rules.
- Added comprehensive README.md with proper format and version number - Enhanced doc.go with complete godoc-compliant documentation - Updated RULES.md to clarify wiki home page requirement 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
44
hlog/doc.go
44
hlog/doc.go
@@ -24,18 +24,22 @@
|
||||
//
|
||||
// # Configuration
|
||||
//
|
||||
// hlog can be configured via environment variables:
|
||||
// hlog can be configured via environment variables using ConfigFromEnv:
|
||||
//
|
||||
// LOG_LEVEL=info # trace, debug, info, warn, error, fatal, panic (default: info)
|
||||
// LOG_OUTPUT=console # console, file, or both (default: console)
|
||||
// LOG_DIR=/var/log/app # Required when LOG_OUTPUT is "file" or "both"
|
||||
// LOG_LEVEL=info # trace, debug, info, warn, error, fatal, panic (default: info)
|
||||
// LOG_OUTPUT=console # console, file, or both (default: console)
|
||||
// LOG_DIR=/var/log/app # Required when LOG_OUTPUT is "file" or "both"
|
||||
// LOG_FILE_NAME=server.log # Required when LOG_OUTPUT is "file" or "both"
|
||||
// LOG_APPEND=true # Append to existing file or overwrite (default: true)
|
||||
//
|
||||
// Or programmatically:
|
||||
//
|
||||
// cfg := &hlog.Config{
|
||||
// LogLevel: hlog.InfoLevel,
|
||||
// LogOutput: "both",
|
||||
// LogDir: "/var/log/myapp",
|
||||
// LogLevel: hlog.InfoLevel,
|
||||
// LogOutput: "both",
|
||||
// LogDir: "/var/log/myapp",
|
||||
// LogFileName: "server.log",
|
||||
// LogAppend: true,
|
||||
// }
|
||||
//
|
||||
// # Log Levels
|
||||
@@ -52,13 +56,27 @@
|
||||
// # Output Modes
|
||||
//
|
||||
// - console: Logs to the provided io.Writer (typically os.Stdout or os.Stderr)
|
||||
// - file: Logs to a file named "server.log" in the configured directory
|
||||
// - both: Logs to both console and file simultaneously
|
||||
// - file: Logs to a file in the configured directory
|
||||
// - both: Logs to both console and file simultaneously using zerolog.MultiLevelWriter
|
||||
//
|
||||
// # File Management
|
||||
//
|
||||
// When using file output, hlog creates a file named "server.log" in the
|
||||
// specified directory. The file is opened in append mode, so logs persist
|
||||
// across application restarts. Remember to call CloseLogFile() when shutting
|
||||
// down your application to ensure all logs are flushed.
|
||||
// When using file output, hlog creates a file with the specified name in the
|
||||
// configured directory. The file can be opened in append mode (default) to
|
||||
// preserve logs across application restarts, or in overwrite mode to start
|
||||
// fresh each time. Remember to call CloseLogFile() when shutting down your
|
||||
// application to ensure all logs are flushed to disk.
|
||||
//
|
||||
// # Error Stack Traces
|
||||
//
|
||||
// hlog automatically configures zerolog to include stack traces for errors
|
||||
// wrapped with github.com/pkg/errors. This provides detailed error context
|
||||
// when using errors.Wrap or errors.WithStack.
|
||||
//
|
||||
// # Integration
|
||||
//
|
||||
// hlog integrates with:
|
||||
// - git.haelnorr.com/h/golib/env: For environment variable configuration
|
||||
// - github.com/rs/zerolog: The underlying logging implementation
|
||||
// - github.com/pkg/errors: For error stack trace support
|
||||
package hlog
|
||||
|
||||
Reference in New Issue
Block a user