On this page
paweljarosz/squid/squid.squid
Squid is a standalone injectable system for saveable logging of user logs, errors and crashes for Defold.
- GitHub: paweljarosz/squid — pinned to
2fe3aed- Pick a release from paweljarosz/squid releases and add its Source code (zip) URL (or a packaged
.zipasset, if the library ships one) togame.projectunder[project]dependencies, then Fetch Libraries in the Defold editor. - Run
bunx @defold-typescript/cli resolveto materialize its types. - Import it under a namespace alias of your choice:
import * as squid from "squid.squid"
- Pick a release from paweljarosz/squid releases and add its Source code (zip) URL (or a packaged
Functions
new(tag?: string, is_allowed?: boolean): SquidInstanceget_config(): SquidConfigset_config(config: SquidConfig)init()set_allowed(tag: string, enabled: boolean)trace(message: string, data?: AnyNotNil, tag?: string)debug(message: string, data?: AnyNotNil, tag?: string)info(message: string, data?: AnyNotNil, tag?: string)warn(message: string, data?: AnyNotNil, tag?: string)error(message: string, data?: AnyNotNil, tag?: string)log(message: string, level: number, data?: AnyNotNil, tag?: string)save_logs(): booleanfinal()
new(tag?: string, is_allowed?: boolean): SquidInstance
Create a new instance of the Squid logger
Parameters
tag?:stringis_allowed?:boolean
Returns
SquidInstance
get_config(): SquidConfig
Get Squid configuration
Returns
SquidConfig
set_config(config: SquidConfig)
Set and use user configuration
Parameters
config:SquidConfig
init()
Initialize Squid for error and crash handling and logging
set_allowed(tag: string, enabled: boolean)
Set if logs should be saved to file
Parameters
tag:stringenabled:boolean
trace(message: string, data?: AnyNotNil, tag?: string)
Parameters
message:stringdata?:AnyNotNiltag?:string
debug(message: string, data?: AnyNotNil, tag?: string)
Parameters
message:stringdata?:AnyNotNiltag?:string
info(message: string, data?: AnyNotNil, tag?: string)
Parameters
message:stringdata?:AnyNotNiltag?:string
warn(message: string, data?: AnyNotNil, tag?: string)
Parameters
message:stringdata?:AnyNotNiltag?:string
error(message: string, data?: AnyNotNil, tag?: string)
Parameters
message:stringdata?:AnyNotNiltag?:string
log(message: string, level: number, data?: AnyNotNil, tag?: string)
Log message with provided level, message, data and tag
Parameters
message:stringlevel:numberdata?:AnyNotNiltag?:string
save_logs(): boolean
Explicitly save buffer of unsaved logs to file
Returns
boolean— true if saved logs successfully, false otherwise
final()
Finalize Squid logging - check for crashes and saved all unsaved buffered logs
Variables
TRACE: number
DEBUG: number
INFO: number
WARN: number
ERROR: number
Types
SquidInstance.init()
Initialize Squid for error and crash handling and logging
SquidInstance.set_allowed(tag: string, enabled: boolean)
Set if logs should be saved to file
Parameters
tag:stringenabled:boolean
SquidInstance.trace(message: string, data?: AnyNotNil, tag?: string)
Parameters
message:stringdata?:AnyNotNiltag?:string
SquidInstance.debug(message: string, data?: AnyNotNil, tag?: string)
Parameters
message:stringdata?:AnyNotNiltag?:string
SquidInstance.info(message: string, data?: AnyNotNil, tag?: string)
Parameters
message:stringdata?:AnyNotNiltag?:string
SquidInstance.warn(message: string, data?: AnyNotNil, tag?: string)
Parameters
message:stringdata?:AnyNotNiltag?:string
SquidInstance.error(message: string, data?: AnyNotNil, tag?: string)
Parameters
message:stringdata?:AnyNotNiltag?:string
SquidInstance.log(message: string, level: number, data?: AnyNotNil, tag?: string)
Log message with provided level, message, data and tag
Parameters
message:stringlevel:numberdata?:AnyNotNiltag?:string
SquidInstance.save_logs(): boolean
Explicitly save buffer of unsaved logs to file
Returns
boolean— true if saved logs successfully, false otherwise
SquidInstance.final()
Finalize Squid logging - check for crashes and saved all unsaved buffered logs