Quickstart¶
Installation and basic usage of the Icecream Truck (ictr) library.
Basic Setup¶
The simplest way to use ictr is to install it into the Python builtins. This
makes the ictr dispatcher available in every module without needing imports.
import ictr
# Install 'ictr' into builtins (default alias is 'ictr')
ictr.install()
Once installed, you can use the ictr dispatcher to create reporters for
various message “flavors”.
>>> # Create a reporter for the 'note' flavor and print a message
>>> ictr( 'note', address = 'doctest' )( 'System initialized.' )
NOTE| System initialized.
>>> # Create a reporter for the 'error' flavor
>>> ictr( 'error', address = 'doctest' )( 'Something went wrong.' )
ERROR| Something went wrong.
Explicit Address¶
By default, ictr infers the calling module’s name as the address. You can
override this to use a custom address, which is useful for organizing output
by component or for per-address configuration.
>>> ictr( 'note', address = 'my.custom.component' )( 'Starting component...' )
NOTE| Starting component...