Compare commits
3 Commits
3bb9256eb8
...
acd7ad3406
Author | SHA1 | Date | |
---|---|---|---|
|
acd7ad3406 | ||
|
0a81acf49e | ||
|
1b2f0d02ef |
@ -2,7 +2,7 @@
|
|||||||
"name": "rage-fw-client",
|
"name": "rage-fw-client",
|
||||||
"version": "0.0.15-alpha.0",
|
"version": "0.0.15-alpha.0",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/src/index.d.ts",
|
||||||
"files": [
|
"files": [
|
||||||
"dist/**/*"
|
"dist/**/*"
|
||||||
],
|
],
|
||||||
@ -10,10 +10,12 @@
|
|||||||
"build": "tsup"
|
"build": "tsup"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ragempcommunity/types-client": "^2.1.8",
|
|
||||||
"rage-fw-shared-types": "workspace:^",
|
"rage-fw-shared-types": "workspace:^",
|
||||||
"rage-rpc": "^0.4.0"
|
"rage-rpc": "^0.4.0"
|
||||||
},
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@ragempcommunity/types-client": "^2.1.8"
|
||||||
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "SashaGoncharov19",
|
"author": "SashaGoncharov19",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
@ -5,7 +5,7 @@ export default defineConfig({
|
|||||||
outDir: './dist',
|
outDir: './dist',
|
||||||
format: ['cjs'],
|
format: ['cjs'],
|
||||||
noExternal: ['rage-rpc'],
|
noExternal: ['rage-rpc'],
|
||||||
dts: true,
|
experimentalDts: true,
|
||||||
splitting: false,
|
splitting: false,
|
||||||
sourcemap: false,
|
sourcemap: false,
|
||||||
clean: true,
|
clean: true,
|
||||||
|
@ -17,10 +17,8 @@
|
|||||||
"prettier": "^3.3.1",
|
"prettier": "^3.3.1",
|
||||||
"rage-rpc": "^0.4.0",
|
"rage-rpc": "^0.4.0",
|
||||||
"tsup": "^8.1.0",
|
"tsup": "^8.1.0",
|
||||||
"typescript": "^5.4.5"
|
"typescript": "^5.4.5",
|
||||||
|
"winston": "^3.13.0"
|
||||||
},
|
},
|
||||||
"type": "module",
|
"type": "module"
|
||||||
"devDependencies": {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
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"
|
"build": "tsup"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ragempcommunity/types-server": "^2.1.8",
|
|
||||||
"rage-fw-shared-types": "workspace:^",
|
"rage-fw-shared-types": "workspace:^",
|
||||||
"rage-rpc": "^0.4.0"
|
"rage-rpc": "^0.4.0"
|
||||||
},
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@ragempcommunity/types-server": "^2.1.8"
|
||||||
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "SashaGoncharov19",
|
"author": "SashaGoncharov19",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
import rpc from 'rage-rpc'
|
import rpc from 'rage-rpc'
|
||||||
|
|
||||||
|
import Logger from './logger'
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
RageFW_ClientEvent,
|
RageFW_ClientEvent,
|
||||||
RageFW_ClientEventArguments,
|
RageFW_ClientEventArguments,
|
||||||
@ -90,4 +92,7 @@ class Player {
|
|||||||
export const fw = {
|
export const fw = {
|
||||||
event: new Server(),
|
event: new Server(),
|
||||||
player: new Player(),
|
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