mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 11:30:43 +00:00
21 lines
512 B
TypeScript
21 lines
512 B
TypeScript
export enum LogSeverity {
|
|
DEBUG = 'DEBUG',
|
|
INFO = 'INFO',
|
|
WARN = 'WARN',
|
|
ERROR = 'ERROR',
|
|
FATAL = 'FATAL'
|
|
}
|
|
|
|
export function slog(eventType: string, description, data: any, severity = LogSeverity.INFO): void {
|
|
const logEntry = {
|
|
eventType: eventType,
|
|
description: description,
|
|
severity: severity,
|
|
data: data
|
|
};
|
|
if (process.env.GAME_ENV == 'dev') {
|
|
console.log(description)
|
|
} else {
|
|
console.log(JSON.stringify(logEntry));
|
|
}
|
|
} |