About This File
To access the console press F11 ingame.
Motivation
RAGE console is designed to be a simple and universal logging library with support for client-side, including CEF and server-side. The server-side currently logs all the logs into separate daily files.
Installation
Installation is extremely simple
- Copy "packages" folder inside your server "packages" folder, except config.json if you have edited it
- Copy "client_packages" folder inside your "client_packages" folder
- Edit your "client_packages" -> index.js to include the rage-console with: require('_rage-console'); (remember to paste this on line 1)
Config
The config exists inside your 'packages/_rage-console/config.json'. You can freely edit these, if no data is provided it will default to default settings. These options are accepted by the config:
- zippedArchive: A boolean to define whether or not to gzip archived log files. (default 'false')
- name: Filename to be used to log to. This filename can include the date placeholder which will include the formatted. (default: 'YYYY-MM-DD')
- maxSize: Maximum size of the file after which it will rotate. This can be a number of bytes, or units of kb, mb, and gb. If using the units, add 'k', 'm', or 'g' as the suffix. The units need to directly follow the number. (default: '30m')
- maxFiles: Maximum number of logs to keep. If not set, no logs will be removed. This can be a number of files or number of days. If using days, add 'd' as the suffix. (default: '30d')
{ "logs": { "name": "YYYY-MM-DD", "maxSize": '30m', "maxFiles": '30d', "zippedArchive": false } }
Upgrading
Upgrading is extremely simple
- Copy "packages" folder inside your server "packages" folder
- Copy "client_packages" folder inside your "client_packages" folder
Usage
Can be used on server-side or client-side. You do not need to require the file as these are available globally.
Writes an info log to the console.
console.log('Hey! Log something?');
Writes an info log to the console.
console.info('Hey! Log something?');
Writes an warning log to the console.
console.warn('Hey! Log something?');
Writes an error log to the console.
console.error('Hey! Log something?');
Usage with CEF (Browser)
To use with CEF you need to add the following line to your HTML <head> element, put this to the top of all your script files.
<script src="package://_rage-console/CEF/debugger.js" crossorigin="anonymous"></script>
Build in commands
help — provides all the commands available
clear — clears all the logs
API
Enable or disable access to console [client-side]
terminal.active = true/false;
Add command handler [client-side]
terminal.commands.add('pos', { description: 'Gets the position of the player' }, function(...arguments) { return ` X: ${user.position.x.toFixed(2)}, Y: ${user.position.y.toFixed(2)}, Z: ${user.position.z.toFixed(2)} - R: ${user.getHeading(true).toFixed(2)}`; });
Todo
- Add options to disable and enable server-side log files
- Add options to custom style the console, mainly due to accessibility
- Run proper tests and clean the logic
- Add ability to see which file the log is coming from
- Add ability to be used with C bridge
Bugs/Feedback
Bugs should be reported currently in RAGE Discord channel to the username @Porn on private message, I appreciate any bugs being reported.
If you have a feature request please do the same as mentioned above.
This is currently in BETA and some stuff is still unpolished.
What's New in Version 0.3.0 See changelog
Released
- Added debugging for CEF
- Added API to add commands
- Added API to disable console
- New fresh look
- Added scrolling to logs
- Bug fixes
- Greener garden