Squish Logs
Docs
Features
Price

Garry's Mod

Integration for Addon Maintainers

If you are a maintainer of an addon, either Commercially or Open-source, we'd love for you to support Squish Logs! This guide will give you the best run down of setting things up, with as little hassel as possible.

Getting developer access to Squish Logs

You might find it useful to be able to play around with Squish Logs when integrating it, so we're more than happy to pass over free access so that you can integrate your addon. You can do that by heading over to our Discord and just letting us know. We'll be more than happy to oblige. If you are found to be using your free Developer access for more than integration with your addon, your access will be revoked.

Creating the folder structure

Not every server running your addon will also be running Squish Logs, so it is better to have Squish Logs act as a kind of module, rather than being integrated directly in your addon. To do this, create the following folders in your addon, myaddon/lua/squish_logs/logs. When a Garry's Mod server starts, it merges all the /addons together. By putting your log integration in the suggested directory, it will allow for Squish Logs to load the file for you, only if it is installed on the server. If it is not installed, the file will never be loaded, preventing potential issues. Inside this folder, you should create a file for your integration. This file should have the prefix of sv_ and be a .lua file. You should also ensure that this file has a unique name, as it will override other Squish Logs integrations with the same file name. For example, if you have a printer addon, you should not call the file sv_printer.lua, but instead, something more unique like sv_tierprinters.lua. The more unique, the better. Please ensure that the file prefix starts with sv_.

Hooking up Squish Logs

Now that you have a file created, you can start populating it with integration. You should be using hooks from your addon to create integrations. If you do not have hooks set up, we suggest you do. Not only is it useful in this case, but it allows other developers to effortlessly create integrations with your addon. Below is an example of an integration with pVault.

hook.Add("pVaultVaultCracked", "SquishLogs:Log:pVault:CrackVault", function(vault, ply)
    SquishLog:New()
        :SetCategory("pVault | Vault")
        :AddFragment(ply)
        :AddFragment(' cracked a vault')
        :Send()
end)

You should try and keep the hook name unique, to prevent conflict. We suggest you follow this hook name format, but it is not required SquishLogs:Log:AddonName:HookName. You can find details on what methods are available with Squish Logs in the Custom Logs section of the documentation, you are free to use all of these integrations when adding support for your addon.