Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add JSON schema #57

Merged
merged 3 commits into from
Oct 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
147 changes: 147 additions & 0 deletions schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
{
"$id": "https://raw.githubusercontent.com/roadrunner-server/logger/refs/heads/master/schema.json",
"$schema": "https://json-schema.org/draft/2019-09/schema",
"description": "All the valid configuration parameters for the Logger plugin for RoadRunner.",
"type": "object",
"title": "roadrunner-logger",
"additionalProperties": false,
"properties": {
"mode": {
"$ref": "#/$defs/LogMode"
},
"level": {
"$ref": "#/$defs/LogLevel"
},
"line_ending": {
"$ref": "#/$defs/LogLineEnding"
},
"encoding": {
"$ref": "#/$defs/LogEncoding"
},
"output": {
"$ref": "#/$defs/LogOutput"
},
"err_output": {
"$ref": "#/$defs/LogOutput"
},
"file_logger_options": {
"$ref": "#/$defs/FileLoggerOptions"
},
"channels": {
"description": "You can configure logging for each plugin individually. The key is the plugin name and the value is logging options in same format as the parent.",
"type": "object",
"additionalProperties": false,
"minProperties": 1,
"patternProperties": {
"^[a-zA-Z0-9._-]+$": {
"mode": {
"$ref": "#/$defs/LogMode"
},
"level": {
"$ref": "#/$defs/LogLevel"
},
"line_ending": {
"$ref": "#/$defs/LogLineEnding"
},
"encoding": {
"$ref": "#/$defs/LogEncoding"
},
"output": {
"$ref": "#/$defs/LogOutput"
},
"err_output": {
"$ref": "#/$defs/LogOutput"
},
"file_logger_options": {
"$ref": "#/$defs/FileLoggerOptions"
}
}
}
}
},
"$defs": {
"FileLoggerOptions": {
"description": "File logger options.",
"type": "object",
"additionalProperties": false,
"properties": {
"log_output": {
"type": "string",
"description": "Path to the log file. Uses <processname>-lumberjack.log and the OS temp (i.e. `/tmp`) directory if empty."
},
"max_size": {
"type": "integer",
"description": "Maximum file size in MB.",
"minimum": 0,
"default": 100
},
"max_age": {
"type": "integer",
"description": "The maximum number of days to retain old log files based on the timestamp encoded in their filename. Empty or zero defaults to 24 days.",
"minimum": 0,
"default": 24
},
"max_backups": {
"type": "integer",
"description": "The maximum number of old log files to retain. Empty or zero defaults to 10.",
"minimum": 0,
"default": 10
},
"compress": {
"type": "boolean",
"description": "Whether to compress log files.",
"default": false
}
}
},
"LogMode": {
"description": "Logging mode",
"type": "string",
"default": "development",
"enum": [
"none",
"off",
"production",
"development",
"raw"
]
},
"LogLevel": {
"description": "Logging level",
"type": "string",
"default": "debug",
"enum": [
"debug",
"info",
"warn",
"error",
"panic"
]
},
"LogEncoding": {
"description": "Encoding format. Default depends on logging mode. For production, `json` is the default, else `console`. Also supports any third-party encodings registered via RegisterEncoder.",
"type": "string",
"enum": [
"console",
"json"
]
},
"LogOutput": {
"type": "array",
"items": {
"type": "string",
"minLength": 1,
"examples": [
"stdout",
"stderr",
"/var/log/rr_errors.log"
]
}
},
"LogLineEnding": {
"description": "Line-ending to use for logging.",
"type": "string",
"default": "\n"
}
}
}
Loading