Skip to main content

A simple logging library

Project description

Bojan Library

BojanConsole is a Python library designed to enhance console logging with various message types and color-coded outputs.

Installation

To install Bojan simply run

pip install bojan

Syntax Highlight

A VS Code extension is available to highlight the .bojan and .bjn log files.

Usage

BojanConsole Class

Initialization

from bojan import BojanConsole

console = BojanConsole(printing=True)

Note that printing decides whether the instance will print to terminal or just store logs for later use.

Logging Messages

  • Info Message:

    console.print("This is an info message.", identifier="🗣️", depth=0)
    

    output:

    🗣️ This is an info message.
    
  • Debug Message:

    console.debug("This is a debug message.")
    

    output:

    💬 This is a debug message.
    
  • Error Message:

    console.error("This is an error message.")
    

    output:

    ❌ This is an error message.
    
  • Success Message:

    console.success("This is a success message.")
    

    output:

    ✅ This is a success message.
    
  • Warning Message:

    console.warning("This is a warning message.")
    

    output:

    ⚠️ This is a debug message.
    

Printing Dictionaries

sample_dict = {"key1": "value1", "key2": {"subkey1": "subvalue1"}}
console.dictionary(sample_dict)

output:

🏰 key1
    🛖 value1
    🛖 subkey1
        🌲 subvalue 1

The emojis use following hierarchy: 🏰 🛖 🌲 🐦 🐛 🧬

Depth

The depth parameter of all logging functions determines how nested the message is by inserting a corresponding amount of tabs.

console.print("Message!", depth=0)
console.print("Nested message!", depth=1)
console.error("Nested error message!", depth=1)

output:

🕸️ Message!
    🕸️ Nested message!
    ❌ Nested error message!

Saving Logs

console.save("logfile.bojan")

License

This project is licensed under the MIT License.

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bojan-0.0.16.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bojan-0.0.16-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file bojan-0.0.16.tar.gz.

File metadata

  • Download URL: bojan-0.0.16.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.13.0

File hashes

Hashes for bojan-0.0.16.tar.gz
Algorithm Hash digest
SHA256 2a3df46ff7bc0ad164e3f3c6f29e32874d586ae54bd2e93f5f8964f4a3f0b1bd
MD5 4055d59610bc68e9a50c3c7f2d0f7d46
BLAKE2b-256 50c97049a6dcfca5808439cee69dde47bd464f0ef96b291476d2fde9baf19f98

See more details on using hashes here.

File details

Details for the file bojan-0.0.16-py3-none-any.whl.

File metadata

  • Download URL: bojan-0.0.16-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.13.0

File hashes

Hashes for bojan-0.0.16-py3-none-any.whl
Algorithm Hash digest
SHA256 29c409251452a7e42eb9a2c1081ab8a18b8e8a6f970b1e9810c44166193f4a8c
MD5 07d88330300329f855bb33998b0f8add
BLAKE2b-256 66896e211675b60f26706ead55487d8a8eb40940f93557ea5d094eaaa2834aaa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page