website-docs/docs/specifications/logging/versions/1.md

39 lines
1.5 KiB
Markdown
Raw Normal View History

2024-03-02 18:26:21 +01:00
---
sidebar_position: 2
title: "1"
description: "Defines StarOpenSource's logging specification"
---
# Version 1
## Log levels
The **SOSLS** provides five log levels: **Error**, **Warning**, **Info**, **Verbose**, **Diagnostic**
### Crash
In addition to the five levels mentioned above, some implementations might implement a **Crash** level if the language/platform itself does not implement such a feature itself (for example a native crash reporter).
## Placeholders
Every logger implementing the **SOSLS** must have support for these placeholders:
```
Placeholder Description Required?
%time% Current UTC time REQUIRED
%time_runtime% Runtime (in milliseconds) OPTIONAL
%color% Log level color REQUIRED
%level% Log level REQUIRED
%message% Log message REQUIRED
%source% The calling file REQUIRED
%function% The calling function OPTIONAL
%line% The calling line OPTIONAL
```
## Format
One of these two formats must be the default:
```
FORMAT 1 - %line% is implemented
"%color%[%time%] [%level% %source%:%line%] %message%"
FORMAT 2 - %line% is not implemented
"%color%[%time%] [%level %source%] %message%"
```
## Configuration
A **SOSLS**-implementing logger must be configurable with support for changing the log level (enum), the log format (string) aswell as displaying color (boolean, should replace `%color%` with `""` if false).