Skip to main content

Log tool (Create / Log / Read / etc...)

Project description

error loading Epitech Logo error loading Jarbin-ToolKit Logo

๐Ÿ“ฆ Jarbin-ToolKit:Log v0.2.1.5

Deterministic file-based logging system with structured formatting, filtering, and dual output modes (jar-log / JSON)


๐Ÿ”น Short Description

Jarbin-ToolKit Log is a lightweight logging system that writes structured log entries to file-based outputs with support for formatted text logs and JSON logs, including filtering, cleaning, and terminal rendering.

It provides:

  • structured log file creation
  • dual format support (jar-log / json)
  • runtime log writing and reading
  • filtering and formatting utilities
  • log compression and cleaning tools
  • terminal-rendered log visualization

It is not a monitoring system, but a deterministic file-based logging abstraction layer.


๐Ÿ”น Authors

  • Nathan (Jarjarbin06)
  • Jarbin Studio

๐Ÿ”น License

GPL v3


๐Ÿ”น Target Audience

This library is intended for:

  • Python developers needing structured logging systems
  • projects requiring file-based audit trails
  • CLI tools needing formatted terminal logs
  • systems requiring lightweight observability layers
  • developers building debugging or tracing utilities

๐Ÿ”น Platform Support

  • Python โ‰ฅ 3.10
  • Standard library only
  • Cross-platform (Linux / Windows / macOS)
  • No external dependencies

๐Ÿ”น Purpose

Jarbin-ToolKit Log aims to:

  • provide deterministic log file creation
  • support structured and human-readable logging formats
  • enable filtering and post-processing of logs
  • offer terminal-friendly log visualization
  • support lightweight JSON logging pipelines

It is not a distributed logging system, but a local deterministic logging abstraction layer over file I/O.


๐Ÿ”น Key Features

  • Dual format logging (jar-log, json)
  • Timestamped structured log entries
  • Severity-based log levels (INFO, DEBUG, WARN, ERROR, CRIT, VALID)
  • Terminal rendering with ANSI coloring
  • Filtering system (keyword-based)
  • Log compression and deduplication
  • Comment insertion in logs
  • File lifecycle management (create, read, close, delete)
  • Log existence detection utility

๐Ÿ”น Architecture Overview

User Code
   โ”‚
   โ–ผ
Log(path, file_name, format)
   โ”‚
   โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
   โ–ผ               โ–ผ
jar-log        JSON mode
   โ”‚               โ”‚
   โ–ผ               โ–ผ
Formatted lines   Structured objects
   โ”‚               โ”‚
   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
           โ–ผ
     File storage layer
           โ”‚
           โ–ผ
   Read / Filter / Render

๐Ÿ”น Core Concept

The system is based on a single entity:

Log

A file-backed logging object responsible for writing, formatting, and managing log entries.

Log(path, file_name=None, json=False)

Execution model:

  • logs are appended immediately to file
  • formatting depends on file type
  • logs are immutable once written
  • post-processing is read-based

๐Ÿ”น API / Function Documentation

๐Ÿ”น Log

Name Description
__init__ Creates log file and initializes format
log Writes structured log entry
comment Writes non-structured comment lines
save Internal write operation
close Finalizes and closes log file
delete Removes log file
read Reads raw log content
__str__ Returns formatted log view
str_filtered Returns filtered formatted logs
_jar_log_str Terminal rendering for jar-log
_json_str Terminal rendering for JSON logs
clean Compresses and simplifies logs
exist Static file existence checker
__repr__ Debug representation

๐Ÿ”น Project Structure

jarbin_toolkit_log/
โ”œโ”€โ”€ log.py
โ””โ”€โ”€ __init__.py

๐Ÿ”น Usage Section

๐Ÿ”น Basic Logging

from jarbin_toolkit_log import Log

log = Log("./logs", "app")

log.log("INFO", "startup", "Application initialized")
log.log("ERROR", "db", "Connection failed")
log.close()

๐Ÿ”น JSON Mode

log = Log("./logs", "app", json=True)
log.log("INFO", "server", "Started successfully")
log.close()

๐Ÿ”น Filtering Output

print(log.str_filtered(["ERROR"]))

๐Ÿ”น Terminal Rendering

print(str(log))

๐Ÿ”น Cleaning Logs

cleaned = log.clean(compress_repeats=True)
print(cleaned)

๐Ÿ”น Build / Installation

Installation

pip install jarbin-toolkit-log

๐Ÿ”น Execution Behavior

  • log creation is immediate and file-backed
  • logs are appended sequentially
  • formatting depends on selected backend
  • JSON mode produces structured arrays
  • jar-log mode produces human-readable streams
  • close() finalizes file integrity (especially JSON)

๐Ÿ”น Memory Model

  • Log stores:

    • file path
    • file name
    • format mode (jar-log / json)
    • closed state flag

No in-memory log buffering (writes are immediate).


๐Ÿ”น Design Philosophy

  • deterministic file output over runtime buffering
  • explicit log lifecycle management
  • dual-format compatibility
  • post-processing over runtime transformation
  • minimal dependency design

๐Ÿ”น Current State

โš ๏ธ Core logging engine is functional and stable

Status:

  • jar-log format implemented
  • JSON format implemented
  • filtering system implemented
  • terminal rendering implemented
  • log cleaning and compression implemented

Limitations:

  • JSON comment support incomplete
  • no asynchronous logging
  • no rotation system
  • no concurrency protection
  • no streaming/log tailing support

๐Ÿ”น Limitations

  • no multi-process safety
  • no automatic log rotation
  • JSON format sensitive to manual corruption
  • performance not optimized for high-frequency logging
  • filtering is post-read only (not indexed)

๐Ÿ”น Extension / Contribution

Possible extensions:

  • log rotation system
  • async logging backend
  • multi-thread safe writes
  • structured query system
  • real-time log streaming
  • indexing for faster filtering

๐Ÿ”น Notes

This system is designed as a lightweight deterministic logging abstraction, not a production-grade distributed observability stack.

It prioritizes:

  • simplicity
  • transparency
  • structured output
  • predictable file behavior

๐Ÿ”น Identity Summary

Jarbin-ToolKit Log is:

  • a structured file logging system
  • a deterministic logging abstraction layer
  • a dual-format log writer (text + JSON)
  • a lightweight debugging and tracing utility

๐Ÿ”น Final Rule

If a log entry is not explicitly written, it does not exist.


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

jarbin_toolkit_log-0.2.1.5.tar.gz (32.8 kB view details)

Uploaded Source

Built Distribution

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

jarbin_toolkit_log-0.2.1.5-py3-none-any.whl (20.4 kB view details)

Uploaded Python 3

File details

Details for the file jarbin_toolkit_log-0.2.1.5.tar.gz.

File metadata

  • Download URL: jarbin_toolkit_log-0.2.1.5.tar.gz
  • Upload date:
  • Size: 32.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for jarbin_toolkit_log-0.2.1.5.tar.gz
Algorithm Hash digest
SHA256 b1afec3869b388fe46c6391dc82dfee192e9c76f6607e51833fe8efb4ba02a54
MD5 d4890a290581f995f731deb6a7dac12f
BLAKE2b-256 ebe1838738548ee4b02c4f873f0504beaf8598bc86b9b3004e30991145687d66

See more details on using hashes here.

File details

Details for the file jarbin_toolkit_log-0.2.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for jarbin_toolkit_log-0.2.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 16f30faee8a28278b9c68d6e20c0fdadba15a75b64c6b524b73547e3af58cd00
MD5 6c2c0d1622f4a2da837e2b2b75506e72
BLAKE2b-256 bb52fd3a5f10e33e09d44d1242755e191fe07edc68b50388e0515cabfd919574

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