cmon2lib
Personal Python library for convenient personalized functionality.
Logging
cmon2lib provides a unified logging system with cross-language compatibility (Python and Bash).
Dual-Output Logging
cmon2lib logs to both console (terminal) and file simultaneously:
| Output | Format | When |
|---|---|---|
| Console | Just the message (colored) | Always |
| Console (WARNING/ERROR) | WARN: message or ERR: message |
For WARNING/ERROR |
| File | Full metadata: `YYYY-MM-DD HH:mm:ss | LEVEL |
Console Colors:
- INFO: No color (clean output)
- DEBUG/TRACE: Dim gray
- SUCCESS: Green
- WARNING: Yellow +
WARN:prefix - ERROR: Red +
ERR:prefix
File Format Example:
2026-04-12 18:14:00 | INFO | ctaiga:get_authenticated_user:33 | simon | Authenticated user ID: 123
Console Output Example (same message):
Authenticated user ID: 123
For WARNING:
WARN: something went wrong
For ERROR:
ERR: connection failed
Python Usage (clog)
from cmon2lib import clog
# Basic logging
clog('info', 'message')
clog('debug', 'value: {}', 42)
# With exception
try:
raise ValueError("test error")
except ValueError as e:
clog('error', 'Operation failed', exception=e)
# Output: Operation failed: ValueError: test error
# Log levels: trace, debug, info, success, warning, error, critical
clog('warning', 'Something might be wrong')
clog('success', 'Operation completed')
Python Usage (cprint - Rich UI Output)
from cmon2lib import cprint
# Rich console output - no file logging
# Supports Rich markup tags for colors and formatting
cprint('info', '[green]✓[/green] Item synced successfully')
cprint('info', '[cyan]Source:[/cyan] {}", source_name)
cprint('warning', '[yellow]![/yellow] Something may be wrong')
cprint('error', '[red]✗[/red] Operation failed')
# cprint is for UI output (trees, tables, formatted messages)
# clog is for operational logs (process info, errors, warnings)
### Bash Usage
```bash
source cmon_lib/cmon_logging.sh
init_clog "my_script"
clog_info "message"
clog_error "error message"
clog_warn "warning message"
clog_success "success message"
Log Levels
| Level | Python | Bash | Description |
|---|---|---|---|
| TRACE | clog('trace', ...) |
N/A | Detailed diagnostic |
| DEBUG | clog('debug', ...) |
N/A | Debug information |
| INFO | clog('info', ...) |
clog_info |
General information |
| SUCCESS | clog('success', ...) |
clog_success |
Success messages |
| WARNING | clog('warning', ...) |
clog_warn |
Warnings |
| ERROR | clog('error', ...) |
clog_error |
Errors |
| CRITICAL | clog('critical', ...) |
N/A | Critical errors |
File Logging
Logs are automatically written to _clog/ directory next to the module:
- Archive log:
{timestamp}_{module}.log- all log messages - Summary log:
{module}_csummary.log- INFO, SUCCESS, ERROR only
If WARN or ERROR is logged, the archive is renamed to *_WARN.log or *_ERR.log.
Log Cleanup
Archive logs older than 30 days are automatically deleted on initialization.
Protected files (never deleted automatically):
*_WARN.log- renamed warning archives*_ERR.log- renamed error archives*_csummary.log- summary logs
Features
- Auto-init on first
clog()call (Python) - Executing user tracking (via
USERorUSERNAMEenv vars) - Single-line exception formatting
- Age-based cleanup (30 days for archives)
- No external dependencies (uses loguru for Python)
Module Structure
cmon2lib/utils/
├── lib/
│ ├── cmon_collect_metadata.py # User, module, caller info collection
│ └── cmon_logging_formatters.py # Log format functions (console, file)
├── cmon_logging_clog.py # clog() - file + console logging
└── cmon_logging_cprint.py # cprint() - Rich console output
Modules
ccaldav
Calendar integration for planning digests.
from cmon2lib.ccaldav import digest_schedule
schedule = digest_schedule(url, username, password)
ctaiga
Taiga project management integration.
from cmon2lib.ctaiga import get_authenticated_user, get_authenticated_user_projects
user = get_authenticated_user(username, password)
projects = get_authenticated_user_projects(username, password)
cowui
Open WebUI utilities for function injection.
from cmon2lib.cowui import inject_string_into_system_message
inject_string_into_system_message(body, "injected text", prefix="\n")
Metadata
Release files for cmon2lib 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cmon2lib-0.2.1.tar.gz | 16.3 kB | Without provenance | Details for cmon2lib-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cmon2lib-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for cmon2lib-0.2.1-py3-none-any.whl |
Total release size: 37.7 kB
Release files / cmon2lib-0.2.1.tar.gz
| Download URL | cmon2lib-0.2.1.tar.gz |
|---|---|
| Size | 16.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e17b2ffc76b9f506850788da3b8a4831e11294c0bc42adf9ed94a2056ca8e4fd
|
|
BLAKE2b-256 checksum How to use checksums |
c77099524c719dcc6c4305897222a333fbc16beb3ff3dc8d639386127fde15e2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / cmon2lib-0.2.1-py3-none-any.whl
| Download URL | cmon2lib-0.2.1-py3-none-any.whl |
|---|---|
| Size | 21.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0304c4522295a1d35107712d3cdcf80bc20b86f0043122fdd18d239a51a6a0c0
|
|
BLAKE2b-256 checksum How to use checksums |
d5b03d98ec5c74b79ab0d7e0e93daad9d38bd1dac7ac66b82e7f79b22ced1f99
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for cmon2lib 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.