Compare commits
3 Commits
3bb9256eb8
...
acd7ad3406
Author | SHA1 | Date | |
---|---|---|---|
|
acd7ad3406 | ||
|
0a81acf49e | ||
|
1b2f0d02ef |
@ -2,7 +2,7 @@
|
||||
"name": "rage-fw-client",
|
||||
"version": "0.0.15-alpha.0",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"types": "dist/src/index.d.ts",
|
||||
"files": [
|
||||
"dist/**/*"
|
||||
],
|
||||
@ -10,10 +10,12 @@
|
||||
"build": "tsup"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ragempcommunity/types-client": "^2.1.8",
|
||||
"rage-fw-shared-types": "workspace:^",
|
||||
"rage-rpc": "^0.4.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@ragempcommunity/types-client": "^2.1.8"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "SashaGoncharov19",
|
||||
"license": "MIT",
|
||||
|
@ -5,7 +5,7 @@ export default defineConfig({
|
||||
outDir: './dist',
|
||||
format: ['cjs'],
|
||||
noExternal: ['rage-rpc'],
|
||||
dts: true,
|
||||
experimentalDts: true,
|
||||
splitting: false,
|
||||
sourcemap: false,
|
||||
clean: true,
|
||||
|
@ -17,10 +17,8 @@
|
||||
"prettier": "^3.3.1",
|
||||
"rage-rpc": "^0.4.0",
|
||||
"tsup": "^8.1.0",
|
||||
"typescript": "^5.4.5"
|
||||
"typescript": "^5.4.5",
|
||||
"winston": "^3.13.0"
|
||||
},
|
||||
"type": "module",
|
||||
"devDependencies": {
|
||||
|
||||
}
|
||||
"type": "module"
|
||||
}
|
||||
|
14312
pnpm-lock.yaml
generated
14312
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -10,10 +10,12 @@
|
||||
"build": "tsup"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ragempcommunity/types-server": "^2.1.8",
|
||||
"rage-fw-shared-types": "workspace:^",
|
||||
"rage-rpc": "^0.4.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@ragempcommunity/types-server": "^2.1.8"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "SashaGoncharov19",
|
||||
"license": "MIT",
|
||||
|
@ -1,5 +1,7 @@
|
||||
import rpc from 'rage-rpc'
|
||||
|
||||
import Logger from './logger'
|
||||
|
||||
import type {
|
||||
RageFW_ClientEvent,
|
||||
RageFW_ClientEventArguments,
|
||||
@ -90,4 +92,7 @@ class Player {
|
||||
export const fw = {
|
||||
event: new Server(),
|
||||
player: new Player(),
|
||||
system: {
|
||||
log: new Logger(),
|
||||
},
|
||||
}
|
||||
|
36
server/src/logger.ts
Normal file
36
server/src/logger.ts
Normal file
@ -0,0 +1,36 @@
|
||||
import winston, { format } from 'winston'
|
||||
const { timestamp, printf, colorize } = format
|
||||
|
||||
export default class Logger {
|
||||
private format = printf(({ message, level, timestamp }) => {
|
||||
return `[${new Date(timestamp).toLocaleTimeString()}] [${level}]: ${message}`
|
||||
})
|
||||
|
||||
private systemLogger = winston.createLogger({
|
||||
transports: [new winston.transports.Console()],
|
||||
format: format.combine(
|
||||
colorize({
|
||||
level: true,
|
||||
colors: {
|
||||
error: 'red',
|
||||
warn: 'yellow',
|
||||
info: 'white',
|
||||
},
|
||||
}),
|
||||
timestamp(),
|
||||
this.format,
|
||||
),
|
||||
})
|
||||
|
||||
public info(message: unknown) {
|
||||
this.systemLogger.info(message)
|
||||
}
|
||||
|
||||
public warn(message: unknown) {
|
||||
this.systemLogger.warn(message)
|
||||
}
|
||||
|
||||
public error(message: unknown) {
|
||||
this.systemLogger.error(message)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user