DebugDataWriter.jl: simple formatted writer of debug information

The package DebugDataWriter.jl provides writing of debug information into external files in a human readable format.

@debug_output path_id file_title data_to_be_formatted

If the output disabled, there is no overhead in a program execution. Only when DebugDataWriter.config().enable_dump = true, the module generates output.


    id = get_debug_id("Some query")
    @debug_output id "some complex structure" ones(2, 3)
    @debug_output id "some structure as lambda" begin
        zeros(5, 2) # here we can put some code for preparing data for output

id is used as a name of further output sub-directory of debug_out. That name will be generated based on current date/time and the provided string in file name allowed format. All non alpha-num symbols are translated into the _ character. The strings as a second argument of the macro @debug_output gives a name of the file for data output. Default data formatter is JSON.

The data for debug output might be provided as a literal, a variable or a lambda function. The lambda-function will be activated if only enable_dump is true.

    matrix = ones(2, 3)
    title = "table from variable from title variable"
    @debug_output id "some complex structure" matrix
    @debug_output id title matrix

    @debug_output id "some structure as lambda" begin
        zeros(5, 2)

Implemented formats are JSON with JSON.jl, HTML and TXT with PrettyTables.jl, and SVG, XML as raw data output.

    @debug_output id "text table" ones(2, 3) :JSON
    @debug_output id "text table" ones(2, 3) :TXT
    @debug_output id "HTML table" ones(2, 3) :HTML
    @debug_output id "HTML table from variable" matrix :HTML
    @debug_output id title matrix :HTML  

The list of serializers/formatters might be modified.

Output files are present in the path debug_out. Default prefix name contains full date-time. If the parameter DebugDataWriter.config().path_format_fulltime = false, then HEX-time in seconds will be used as a prefix. So, directories based on the id might be naturally alphabetically ordered accordingly to the time when the id was generated. Debug output with the same id means creation of multiple files in the same directory.

    ├── debug_out
    │   ├── 1872ecb296f_Another_query
    │   │   └── with_details.json
    │   ├── 20230329-221437-037
    │   │   └── array.json
    │   ├── 20230329-221437-037_Another_query
    │   │   ├── HTML_table.html
    │   │   ├── HTML_table_from_variable.html
    │   │   ├── some_SVG.svg
    │   │   ├── some_XML.xml
    │   │   ├── some_complex_structure.json
    │   │   ├── some_structure_as_lambda.json
    │   │   ├── table_from_variable_from_title_variable.html
    │   │   ├── table_from_variable_from_title_variable.json
    │   │   ├── text_as_a_text.txt
    │   │   ├── text_table.json
    │   │   └── text_table.txt
    │   └── 20230329-221437-037_query_with_something_interesting
    │       └── some_dict.json