Documentation
¶
Index ¶
- Constants
- func GetHandler(value string, writer io.Writer, opts *slog.HandlerOptions, ...) slog.Handler
- func GetLevel(value string, defaultLevel slog.Leveler) slog.Leveler
- func GetLogFile(filePath string, filePerm os.FileMode) (io.WriteCloser, error)
- func New(c Config, out io.Writer, organization, project string) *slog.Logger
- func TimeUTCReplaceAttr(_ []string, a slog.Attr) slog.Attr
- func TimeUTCValue(t time.Time) slog.Value
- type Config
- type RecordTime
Constants ¶
View Source
const ( LevelDebug = "debug" LevelInfo = "info" LevelWarn = "warn" LevelError = "error" )
View Source
const ( TextHandlerSelector = "text" JsonHandlerSelector = "json" DiscardHandlerSelector = "discard" )
Variables ¶
This section is empty.
Functions ¶
func GetHandler ¶
func GetLogFile ¶
Types ¶
type Config ¶
type Config struct { Handler string `json:"handler" env_var:"LOGGER_HANDLER"` Level string `json:"level" env_var:"LOGGER_LEVEL"` TimeFormat string `json:"time_format" env_var:"LOGGER_TIME_FORMAT"` TimeUtc bool `json:"time_utc" env_var:"LOGGER_TIME_UTC"` FilePath string `json:"file_path" env_var:"LOGGER_FILE_PATH"` AddSource bool `json:"add_source" env_var:"LOGGER_ADD_SOURCE"` AddMeta bool `json:"add_meta" env_var:"LOGGER_ADD_META"` }
type RecordTime ¶
type RecordTime struct {
// contains filtered or unexported fields
}
func NewRecordTime ¶
func NewRecordTime(format string, utc bool) *RecordTime
func (*RecordTime) ReplaceAttr ¶
Click to show internal directories.
Click to hide internal directories.