Fixed lint issues and missing documentation
This commit is contained in:
1 parent
7fd321df97
commit
6e6dec68c0
34 files changed
+346
-156
No files matched your search
@@ -6,18 +6,17 @@ import (
|
||||
"reflect"
|
||||
)
|
||||
|
||||
// JSCKLogging is the logging section's configuration key.
|
||||
const JSCKLogging string = "logging"
|
||||
|
||||
// JobSearchConfigLogging configures logging. Level is one of debug, info,
|
||||
// warn or error. File, if set, is where commands that log to a file write.
|
||||
type JobSearchConfigLogging struct {
|
||||
Level string `cfg:"level" default:"warn"`
|
||||
File string `cfg:"file"`
|
||||
}
|
||||
|
||||
/*
|
||||
* General section functions
|
||||
* See related methods in section.go
|
||||
*/
|
||||
func (c *JobSearchConfigLogging) Keys() []string { return keysOf(c) }
|
||||
// ---------- Section methods (see Section) ----------
|
||||
|
||||
func (c JobSearchConfigLogging) Map() map[string]any { return mapOf(c) }
|
||||
|
||||
@@ -37,8 +36,12 @@ func (c *JobSearchConfigLogging) SetValue(key string, value any) error {
|
||||
return setValue(c, key, value)
|
||||
}
|
||||
|
||||
/* Section specific functions */
|
||||
// Checks values before they are stored (see validator)
|
||||
// Keys returns the keys directly in the section.
|
||||
func (c *JobSearchConfigLogging) Keys() []string { return keysOf(c) }
|
||||
|
||||
// ---------- Section specific methods ----------
|
||||
|
||||
// validate checks values before they are stored (see validator).
|
||||
func (c *JobSearchConfigLogging) validate(key string, value any) error {
|
||||
switch key {
|
||||
case "level":
|
||||
@@ -52,7 +55,8 @@ func (c *JobSearchConfigLogging) validate(key string, value any) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Utility methods for converting level strings to slog levels
|
||||
// ConfigLevelToLogLevel converts a configured level name to an slog level. An
|
||||
// unknown name gives 99, above every real level, so nothing is logged.
|
||||
func ConfigLevelToLogLevel(level string) slog.Level {
|
||||
switch level {
|
||||
case "debug":
|
||||
|
||||
Reference in new issue
Block a user