website-docs/docs/specifications/logging/versions/1.md
2024-03-02 18:26:21 +01:00

1.5 KiB

sidebar_position title description
2 1 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).