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.3.0

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.3.0.tar.gz (33.1 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.3.0-py3-none-any.whl (20.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: jarbin_toolkit_log-0.2.3.0.tar.gz
  • Upload date:
  • Size: 33.1 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.3.0.tar.gz
Algorithm Hash digest
SHA256 54226295495187484d4ec048beb94a282cd9367bee838cdc8b05c0870c679489
MD5 a85ad719c6c26ac3e9d8a4400b3b4851
BLAKE2b-256 c80606b19b7aa43e4d6c93012673a9ebf3155dcfa67e3cad82febfd626effc10

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jarbin_toolkit_log-0.2.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7f571d799290eca7b48d96698e037308f229e25297e00289c52dcb11109bbe3d
MD5 b966d6da6743b6fd96adac6234164067
BLAKE2b-256 ce5a4492d76e59031b39387c37f10cc6fb5a340f9c646e18537320037320ca5d

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