Skip to main content

10 languages Zero deps License Copy paste

🐞 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 "..."

Python

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 py-logn 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for py-logn 1.0.0
File Size Uploaded
py_logn-1.0.0.tar.gz 5.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for py-logn 1.0.0
File Interpreter ABI Platform
py_logn-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.3 kB

Release files / py_logn-1.0.0.tar.gz

Download URL py_logn-1.0.0.tar.gz
Size 5.6 kB
Tags Source
SHA-256 checksum
How to use checksums
fd7b380b87a5b4d6b0c996589ff8a70835a03b8ee30c5591b43c45056e02c9d0
BLAKE2b-256 checksum
How to use checksums
3ae2ad27d823615902f30421e23f98ac5223e6b8ad2a257b95f2f8220d6c0f97
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / py_logn-1.0.0-py3-none-any.whl

Download URL py_logn-1.0.0-py3-none-any.whl
Size 5.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7271666d4b3065771496a61c768afae79dd49a9a084353351604519e96ca0002
BLAKE2b-256 checksum
How to use checksums
8c15ef15e8eeb71865649562b6b56b0318bb13b4dc40a172253348c40f9e47ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page