client logger

This commit is contained in:
Oleksandr Honcharov 2024-06-11 21:30:39 +03:00
parent 97b094c3d4
commit 39ab22f9aa
2 changed files with 24 additions and 0 deletions

View File

@ -1,5 +1,7 @@
import rpc from 'rage-rpc'
import Logger from './logger'
import type {
RageFW_ClientEventCallback,
RageFW_ClientEvent,
@ -31,4 +33,7 @@ class Player {
export const fw = {
event: new Client(),
player: new Player(),
system: {
log: new Logger(),
},
}

19
client/src/logger.ts Normal file
View File

@ -0,0 +1,19 @@
export default class Logger {
public error(message: unknown) {
mp.console.logError(
`[${new Date().toLocaleTimeString()}] [ERROR] ${message}`,
)
}
public warn(message: unknown) {
mp.console.logWarning(
`[${new Date().toLocaleTimeString()}] [WARN] ${message}`,
)
}
public info(message: unknown) {
mp.console.logInfo(
`[${new Date().toLocaleTimeString()}] [INFO] ${message}`,
)
}
}