Some checks failed
Go CI/CD / go-ci (push) Has been cancelled
Introduce tests for handling panic and fatal log scenarios, including recovery from panics and execution of external processes to test fatal behavior. Adjusted logging levels and prefixes to ensure consistency for PANIC logs.
π₯ Stonelog - 10 Billion Times Better Logging!
The most scientifically badass logging library from the Kingdom of Science!
π Why Stonelog?
- Dr.Stone-themed logging that Senku would approve
- Dramatic error messages worthy of a lab explosion
- Character quotes from your favorite scientists
- 10 billion watts of scientific swagger
π₯ Installation
go get gitstormr.dev/stone-utils/stonelog@latest
β‘ Initialization
package main
import (
"gitstormr.dev/stone-utils/stonelog"
)
func main() {
// Basic configuration (INFO level by default)
stonelog.InitStoneLog(stonelog.INFO, false, false) // false = text mode (true = JSON), false = keep suffixes (true = don't add character quotes)
// Example logs
stonelog.Observation("System initialized successfully!")
stonelog.Failure("Reactor core temperature critical!")
}
π Log Levels (Scientific Style!)
Function | Level Equivalent | Example Output |
---|---|---|
Trace() | TRACE | π Science traces: Entering function X |
Debug() | DEBUG | π€ Hypothesis forming: Variable X = 42 |
Observation() | INFO | β Experiment successful: User logged in |
Hypothesis() | WARN | β οΈ Anomaly detected: High memory usage |
Failure() | ERROR | π₯ Critical malfunction: DB disconnected |
Meltdown() | FATAL | β οΈ FINAL EXPERIMENT FAILED: Server exploded |
Panic() | PANIC | π¨ CHAIN REACTION DETECTED: Unrecoverable error |
ποΈ Changing Log Level
// Dynamic change! (e.g., enable DEBUG in production)
stonelog.SetLogLevel(stonelog.DEBUG)
π¬ JSON Mode (For Production)
stonelog.InitStoneLab(stonelog.STONE_DEBUG, true, false) // true = JSON, false = Keep suffixes
// Output: {"time":"2023-07-15T12:00:00Z","level":"OBSERVATION","message":"β
Experiment successful: System ready","caller":"main.go:15"}
π¨ WINDOWS COLOR SUPPORT NOTICE π¨
"HEY WINDOWS USERS! YOUR TERMINALS NEED SOME SCIENCE!" - Chrome
π¬ Current Limitations:
- Colors don't work in old Windows Command Prompt (CMD)
- Looks boring in black & white (like stone tablets!)
- Works perfectly in modern terminals
π‘ Senku-Approved Solutions:
- Install Windows Terminal (Microsoft Store)
- Use WSL (Windows Subsystem for Linux)
- Try VS Code or Git Bash
"This temporary setback represents just 0.0000001% of our scientific progress!"
- Dr. Senku Ishigami
(Chrome whispers: "Pssst... Linux terminals are SO BADASS!") π§π₯
Join the Scientific Revolution!
"This isn't just logging - it's 10 billion percent scientific progress!" - Senku Ishigami
Kingdom of Science Approved
(Now with 100% more Chrome screaming "SO BADASS!")
v1.0.0
Latest
Languages
Go
100%