shobiz

Simple structured console messages for Nim applications.

Pure Nim score 15/100 · tests present · no docs generated

Summary

Latest Version 1.1.0
License MIT
CI Status Failing
Downloads 0
Last Indexed 2026-07-21 05:26

Authors

  • VanCuren, Logan

Installation

nimble install shobiz
choosenim install shobiz
git clone https://github.com/logavanc/shobiz

OS Compatibility

Platform Linux macOS Windows FreeBSD OpenBSD NetBSD Android iOS WASM Embedded
shobiz - - - - - - -

Dependencies

Package Version Optional
nim >= 2.0.4 No

Source

Repository https://github.com/logavanc/shobiz
Homepage https://github.com/logavanc/shobiz
Registry Source nimble_official

README

shobiz

nimble install shobiz

Github Actions

API reference

Simple structured console messages for Nim applications.

About

shobiz is a simple library for outputting structured console messages in Nim applications. Configuration is done with global variables (there is no need to pass around a logger object), and the API consists of only a few methods.

import shobiz
import json

SHO_PRETTY = true # These should be set with the
SHO_DEBUG = true  # command line arg parser of your choice.

"Hello, Message!".shoMsg()
"Hello, Debug!".shoDbg(%*{"interesting": 1234}) # This is only shown if SHO_DEBUG is true.

try:
  raise newException(KeyError, "Hello, Error!")
except Exception as err:
  err.shoExc()
{
    "timestamp": "2024-05-27T21:57:43.862-07:00",
    "level": "Message",
    "message": "Hello, World!"
}
{
    "timestamp": "2024-05-27T21:57:43.862-07:00",
    "level": "Debug",
    "message": "Hello, Debug!",
    "data": {
        "interesting": 1234
    }
}
{
    "timestamp": "2024-05-27T21:57:43.862-07:00",
    "level": "Error",
    "type": "KeyError",
    "message": "Hello, Error!"
}

Pretty Flag

The SHO_PRETTY flag is used to determine if the output should be pretty-printed or not. If set to true, the output will be formatted with newlines and indentation, and is intended for human consumption. If set to false(the default), the output will be a single line of minified JSON, which is great for piping to other programs (like jq) or writing to a log file (like | tee -a log.jsonl).

Debug Flag

The SHO_DEBUG flag is used to determine if debug messages should be shown or not. If set to true, debug messages will be shown. If set to false(the default), debug messages will be suppressed.