Public software projects made or coordinated by Lawrence Heyfron

Introducing Clarity

Clarity is a logging framework that prints log data referenced from JSON to the console and displays the output using semantic formatting.


Clarity assumes three main ‘nodes’ of interest in an application control flow: function call points, the resolution of conditional statements and the reporting of specific values including errors. Clarity print statements are designed to be placed at such node points in the client application source code.

All message data relating to each print statement is placed entirely in associated JSON files referenced by a unique number (print number). This enables the printing of an unlimited amount of information to the console with negligible impact on the source code.

The customisable formatting of console log output is designed to emphasise nodes of interest in a clear narrative of the control flow. The output includes symbol strings that relate to the functionality and purpose of the code such that it is human readable and understandable at first sight.

Customisable settings enable the isolation of specific nodes and referenced data.

The minimal API consists of two overload analogues of the Swift print function – print(_:functionName:settings:) and print(_:values:settings:) these functions reference associated JSON data via the print number passed to the first unlabelled parameter.

Please share!