{"record":{"id":"1b37e23dfb15a64f","repo":"slackhq/nebula","slug":"unknown-log-format-s-possible-formats-s","errorCode":null,"errorMessage":"unknown log format `%s`. possible formats: %s","messagePattern":"unknown log format `(.+?)`\\. possible formats: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"logging/logger.go","lineNumber":143,"sourceCode":"\n// SetLevel updates the effective log level. Propagates to every derived\n// logger via the shared LevelVar.\nfunc (h *Handler) SetLevel(level slog.Level) { h.root.level.Set(level) }\n\n// GetLevel reports the current log level.\nfunc (h *Handler) GetLevel() slog.Level { return h.root.level.Level() }\n\n// SetFormat flips the output format atomically. Valid formats are \"text\"\n// and \"json\". Every derived logger sees the new format on its next Handle\n// call; no rebuild or registration is required.\nfunc (h *Handler) SetFormat(format string) error {\n\tswitch format {\n\tcase \"text\":\n\t\th.root.jsonMode.Store(false)\n\tcase \"json\":\n\t\th.root.jsonMode.Store(true)\n\tdefault:\n\t\treturn fmt.Errorf(\"unknown log format `%s`. possible formats: %s\", format, []string{\"text\", \"json\"})\n\t}\n\treturn nil\n}\n\n// GetFormat reports the currently selected format name.\nfunc (h *Handler) GetFormat() string {\n\tif h.root.jsonMode.Load() {\n\t\treturn \"json\"\n\t}\n\treturn \"text\"\n}\n\n// SetDisableTimestamp toggles whether Handle zeroes r.Time before\n// dispatching (slog's builtin text/json handlers skip emitting the time\n// attribute on a zero time).\nfunc (h *Handler) SetDisableTimestamp(v bool) { h.root.disableTimestamp.Store(v) }\n\n// ApplyConfig reads logging.level, logging.format, and (optionally)","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/slackhq/nebula/blob/dd8f660c0ac37903ec4080ca4d3c861ba9342ceb/logging/logger.go#L125-L161","documentation":"SetFormat validates the requested log format against the supported set ('text' and 'json') and returns this error for anything else. It is an input validation error on the Handler's format configuration.","triggerScenarios":"Calling Handler.SetFormat with any string other than \"text\" or \"json\", e.g. \"logfmt\", \"TEXT\", or empty string.","commonSituations":"Typo in config 'logging.format'; case sensitivity; copying formats from another logging library that supports logfmt/syslog.","solutions":["Pass exactly \"text\" or \"json\" to SetFormat","Normalize/trim the format string before calling SetFormat","Default to \"text\" when the config value is absent"],"exampleFix":"// before\nerr := h.SetFormat(\"logfmt\")\n// after\nformat := strings.ToLower(strings.TrimSpace(cfg.Format))\nif format != \"json\" {\n    format = \"text\"\n}\nerr := h.SetFormat(format)","handlingStrategy":"validation","validationCode":"switch strings.ToLower(strings.TrimSpace(format)) {\ncase \"text\", \"json\", \"\":\n    // ok\ndefault:\n    return fmt.Errorf(\"unsupported log format %q\", format)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use only 'text' or 'json' for logging.format","Normalize case/whitespace before calling SetFormat","Handle SetFormat's error at startup rather than ignoring it"],"tags":["logging","configuration","validation"],"backgroundTag":"invalid-config-value","analyzedSha":"dd8f660c0ac37903ec4080ca4d3c861ba9342ceb","analyzedAt":"2026-09-03T11:13:55.444Z","contentChangedAt":"2026-09-03T11:13:55.444Z","schemaVersion":2},"datasetVersion":"2026-09-10T17:17:09.494Z"}