🐞 LogX
One file. Ten languages. Zero dependencies.
Copy. Paste. Log.
What if logging were this easy?
from logx import info, warn, error
info("Server started on port %d", 8080)
warn("Memory at %.1f%%", 74.2)
error("Connection lost")
LOGX_INFO("Server started on port %d", 8080);
LOGX_WARN("Memory at %.1f%%", 74.2);
LOGX_ERROR("Connection lost");
logx_info!("Server started on port {}", 8080);
logx_warn!("Memory at {:.1}%", 74.2);
logx_error!("Connection lost");
That's it. No installs. No config files. No npm install hunting down 200 transitive deps.
Why LogX?
Logging should be as easy as print(). But print() doesn't give you levels, timestamps, colors, or file output.
Most logging libraries give you all that — and also give you a headache. Setup, configuration, dependencies, framework lock-in...
LogX is the opposite. One file per language. Same API philosophy everywhere. Drop it in, include it, done.
Why not just print()?
| Feature | print() |
LogX |
|---|---|---|
| Log levels | ❌ | ✅ TRACE, INFO, WARN, ERROR, FATAL |
| Timestamps | ❌ | ✅ [HH:MM:SS.mmm] |
| File & line | ❌ | ✅ Automatic |
| Colored output | ❌ | ✅ Auto TTY detection |
| File logging | ❌ | ✅ Optional, one call |
| Thread safe | ❌ | ✅ Mutex-guarded |
| Level filtering | ❌ | ✅ LOG_LEVEL=WARN ./app |
| Still one file | ✅ | ✅ |
Quick Start
| Language | File | Include |
|---|---|---|
| Python | python/logx.py |
from logx import info |
| JavaScript | js/logx.js |
const { info } = require('./logx') |
| TypeScript | ts/logx.ts |
import { info } from './logx' |
| C | c/logx.h |
#include "logx.h" → LOGX_INFO(...) |
| C++ | cpp/logx.h |
#include "logx.h" → LOGX_INFO << ... |
| Rust | rust/logx.rs |
#[macro_use] mod logx; → logx_info!(...) |
| Go | go/logx.go |
import "yourmodule/logx" → logx.Info(...) |
| Java | java/logx.java |
import Logx; → Logx.info(...) |
| Zig | zig/logx.zig |
@import("logx.zig") → logx.log(.info, ...) |
| Assembly | asm/logx.asm |
%include "logx.asm" → log_info "..." |
Install via pip (Python)
pip install python-logx
from logx import trace, info, warn, error, fatal, set_log_file
info("hello %d", 42)
error("something broke")
set_log_file("/tmp/app.log") # redirect to file
JavaScript (Node)
const { trace, info, warn, error, fatal, setLogFile } = require('./logx');
info('hello %d', 42);
error('something broke');
TypeScript
import { trace, info, warn, error, fatal, setLogFile } from './logx';
info('hello %d', 42);
error('something broke');
C
#include "logx.h"
int main() {
LOGX_INFO("hello %d", 42);
LOGX_ERROR("something broke");
}
// Optional: log to file
lx_set_log_file("/tmp/app.log");
gcc -std=c11 main.c -o app -lpthread
C++
#include "logx.h"
int main() {
LOGX_INFO << "hello " << 42;
LOGX_ERROR << "something broke";
}
// Optional: log to file
Logx::setLogFile("/tmp/app.log");
Logx::setLogFile(); // back to terminal
g++ -std=c++11 main.cpp -o app
Rust
#[macro_use] mod logx;
fn main() {
logx_info!("hello {}", 42);
logx_error!("something broke");
}
// Optional: log to file
logx::set_log_file("/tmp/app.log");
[dependencies]
libc = "0.2"
Go
package main
import "yourmodule/logx"
func main() {
logx.Info("hello %d", 42)
logx.Error("something broke")
}
// Optional: log to file
logx.SetLogFile("/tmp/app.log")
Java
public class Main {
public static void main(String[] args) {
Logx.info("hello %d", 42);
Logx.error("something broke");
}
}
// Optional: log to file
Logx.setLogFile("/tmp/app.log");
javac Logx.java Main.java && java Main
Zig
const logx = @import("logx.zig");
pub fn main() void {
logx.log(.info, "hello 42", @src());
logx.log(.error, "something broke", @src());
}
// Optional: log to file
try logx.setLogFile("/tmp/app.log");
x86-64 Assembly (Linux, NASM)
%include "logx.asm"
section .data
log_str(msg_hello, "hello 42")
log_str(msg_error, "something broke")
section .text
global _start
_start:
call log_init
log_info msg_hello
log_error msg_error
call log_close
mov rax, 60
xor rdi, rdi
syscall
; Optional: log to file (define before including)
%define LOG_FILE_PATH "/tmp/app.log"
%include "logx.asm"
nasm -felf64 main.asm -o main.o && ld main.o -o main
Environment Variables
| Variable | Values | Default |
|---|---|---|
LOG_LEVEL |
TRACE, INFO, WARN, ERROR, FATAL |
TRACE |
LOG_COLOR |
0, 1, yes |
Auto (enabled if both stdout/stderr are TTYs) |
Output Format
[HH:MM:SS.mmm][LEVEL] filename:line -> message
Philosophy
LogX is not trying to replace OpenTelemetry. It is built for:
- Prototypes & hackathons
- CLI tools & scripts
- Game jams
- Students learning a new language
- Small-to-medium projects
- Anyone who just wants to log without ceremony
"If you can write print(), you already know how to use LogX."
License
BSD 2-Clause. See LICENSE.
Metadata
Release files for python-logx 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| python_logx-1.0.0.tar.gz | 5.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| python_logx-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.4 kB
Release files / python_logx-1.0.0.tar.gz
| Download URL | python_logx-1.0.0.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0542317af0f7cb8c31a1b6a1d001ec8f887767e4508ac69feed27943df3d42c1
|
|
BLAKE2b-256 checksum How to use checksums |
0978492c5cd65d4283594b590a874a4bbe574b36a8811f6ee5465fd9d0d019be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / python_logx-1.0.0-py3-none-any.whl
| Download URL | python_logx-1.0.0-py3-none-any.whl |
|---|---|
| Size | 5.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6dcf79e9edf872f6773e25a1aa883095721f1cb0d18bd0d09c421e6d7d18b9b3
|
|
BLAKE2b-256 checksum How to use checksums |
666a3a75179dace7fbaac0f9edf78b2bb1092eddc62828b1b412b2b95c0ff1f1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|