mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-02 05:48:06 +00:00
format codebase with prettier
This commit is contained in:
+25
-25
@@ -1,33 +1,33 @@
|
||||
import { ClientID, GameID, LogSeverity } from "../core/Schemas";
|
||||
|
||||
export interface slogMsg {
|
||||
logKey: string,
|
||||
msg: string,
|
||||
data?: any
|
||||
severity?: LogSeverity
|
||||
gameID?: GameID
|
||||
clientID?: ClientID
|
||||
persistentID?: string
|
||||
logKey: string;
|
||||
msg: string;
|
||||
data?: any;
|
||||
severity?: LogSeverity;
|
||||
gameID?: GameID;
|
||||
clientID?: ClientID;
|
||||
persistentID?: string;
|
||||
}
|
||||
|
||||
export function slog(msg: slogMsg): void {
|
||||
msg.severity = msg.severity ?? LogSeverity.Info;
|
||||
msg.severity = msg.severity ?? LogSeverity.Info;
|
||||
|
||||
if (process.env.GAME_ENV == 'dev') {
|
||||
// Avoid blowing up the log during development.
|
||||
if (msg.logKey == 'client_console_log') {
|
||||
return
|
||||
}
|
||||
if (msg.severity != LogSeverity.Debug) {
|
||||
console.log(msg.msg)
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
console.log(JSON.stringify(msg));
|
||||
} catch (error) {
|
||||
console.error('Failed to stringify log message:', error);
|
||||
// Fallback to basic logging
|
||||
console.log(`${msg.severity}: ${msg.msg}`);
|
||||
}
|
||||
if (process.env.GAME_ENV == "dev") {
|
||||
// Avoid blowing up the log during development.
|
||||
if (msg.logKey == "client_console_log") {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (msg.severity != LogSeverity.Debug) {
|
||||
console.log(msg.msg);
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
console.log(JSON.stringify(msg));
|
||||
} catch (error) {
|
||||
console.error("Failed to stringify log message:", error);
|
||||
// Fallback to basic logging
|
||||
console.log(`${msg.severity}: ${msg.msg}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user