Description
D-Logging is an better Logging system for fivem. Its an cheap copy of javas log4j .
Anyway, it does really improve debugging and logging in general. The biggest advantage is that you can easily find out bugs on liveservers and reduce the work to remove useless prints, if you have done it correctly.
It provides 7 levels of logging. There are trace, debug, info, warning, error, fatal and discord. You can configure for each level if they should save in a log file and if yes, in which file.
You can configure which level should be printed, which makes it usable and essential not just for test server but also for live servers.
Its also very simple to use, you just need to implement an shared script in your resource lua and youβre good to go
But to keep it simple here an basic list of the features
Features
- Open Source
- Easy to use
- You can configure each level indivuadilly
- Easy integration
- Option so save logs in a file, so youre customers or you can look in the log and find the bug for a script instead of scrolling endlessly thourgh your server console
- Option to also send it to discord via webhooks
- Works for client and server side
- Decide which scripts you want to show
- Hide prints of Scripts ( which uses d-logging )
Installation
-
Drag it in your resource folder
-
add this in your server.cfg
ensure d-logging
Configuration
In the top of the log.lua you can find everything you need to configure.
How to add this to your scripts
Add this to the fxmanifest- / resource.lua
shared_script {
'@d-logging/log.lua',
}
With this you can acess all the functions
Functions
Log.trace("trace")
Log.debug("debug")
Log.info("info")
Log.warn("warn")
Log.error("error")
Log.fatal("fatal")
Log.discord("discord")
Here an Image where you can see how it looks
When to use which level
Thats something you have to decide yourself which level you think is necessary for your purpose, but here is an small guideline which could be helpful.
Trace - More detailed information then Debug which are not really necessary to have but still help to follow the flow of your resource e.g. which functions are triggerd.
Debug - Log everything you as developer need to see if your script works but is not to detailed
Info - Log stuff which is information based like when the script is started, or notifications or stuffe like this
Warn - Log stuff that doenst stuff the resource but might be dangerous so we should take a look at it, like slow querys
Error - Stuff which causes a function or event to work and is very dangerous.
Fatal - If the complete script could crash
Discord - You can setup an webhook for this to send logs via the webhook to your discord channel
Download
If you have any improvement ideas fell free to write a message me or in the comments