A cli tool to prettify stacktrace in json logs.

Related tags

Miscellaneous stack
Overview

stack

A cli tool to prettify stacktrace in json logs.

Why to write this tool?

When we read the stacktrace info from json logs, it's hard to read without pretty print.

Usage

1. From stdin

{"@timestamp":"2023-01-20T19:56:57.806+08:00","content":"panic\ngoroutine 1 [running]:\nruntime/debug.Stack()\n\t/usr/local/go/src/runtime/debug/stack.go:24 +0x64\ngithub.com/zeromicro/go-zero/core/logx.writeStack({0x14000092008, 0x5})\n\t/Users/kevin/Develop/go/opensource/go-zero/core/logx/logs.go:457 +0x48\ngithub.com/zeromicro/go-zero/core/logx.ErrorStack({0x140002dff58?, 0x1400010e000?, 0x0?})\n\t/Users/kevin/Develop/go/opensource/go-zero/core/logx/logs.go:113 +0x24\nmain.main()\n\t/Users/kevin/Develop/go/opensource/go-zero/adhoc/log/main.go:17 +0x80\n","level":"error"}
$ tail -f error.log | stack -i
{"@timestamp":"2023-01-20T19:57:01.810+08:00","content":"panic
goroutine 1 [running]:
runtime/debug.Stack()
	/usr/local/go/src/runtime/debug/stack.go:24 +0x64
github.com/zeromicro/go-zero/core/logx.writeStack({0x1400012e240, 0x5})
	/Users/kevin/Develop/go/opensource/go-zero/core/logx/logs.go:457 +0x48
github.com/zeromicro/go-zero/core/logx.ErrorStack({0x140002dff58?, 0x1400009c540?, 0x140000b8060?})
	/Users/kevin/Develop/go/opensource/go-zero/core/logx/logs.go:113 +0x24
main.main()
	/Users/kevin/Develop/go/opensource/go-zero/adhoc/log/main.go:17 +0x80
","level":"error"}

2. From clipboard

Steps

  1. copy the content
  2. run stack without -i
{"@timestamp":"2023-01-20T19:57:01.810+08:00","content":"panic
goroutine 1 [running]:
runtime/debug.Stack()
	/usr/local/go/src/runtime/debug/stack.go:24 +0x64
github.com/zeromicro/go-zero/core/logx.writeStack({0x1400012e240, 0x5})
	/Users/kevin/Develop/go/opensource/go-zero/core/logx/logs.go:457 +0x48
github.com/zeromicro/go-zero/core/logx.ErrorStack({0x140002dff58?, 0x1400009c540?, 0x140000b8060?})
	/Users/kevin/Develop/go/opensource/go-zero/core/logx/logs.go:113 +0x24
main.main()
	/Users/kevin/Develop/go/opensource/go-zero/adhoc/log/main.go:17 +0x80
","level":"error"}

Give a Star!

If you like or are using this project to learn or start your solution, please give it a star. Thanks!

You might also like...
Tool to make Solus packaging even easier.

A small tool to make packaging for Solus even easier. Features Remove all packages from the local solbuild repo.

A library and tool for automata and formal languages, inspired by JFLAP
A library and tool for automata and formal languages, inspired by JFLAP

Sugarcubes is a library and application for automata and formal languages. It is inspired by JFLAP, and is intended to eventually to be an alternative to JFLAP.

Benchmarking web frameworks written in rust with rewrk tool.

Web Framework Benchmarks Benchmarking web frameworks written in rust with rewrk tool.

Lightweight tool for simple deployment (server+client)

deploy Lightweight tool for simple deployment (server+client) Usage You first need a key value pair: deploy generate-keys Public-Key: Used on the serv

A cog-like tool, written in Rust.

Corg A cog-like tool, written in Rust. The primary difference between Cog and Corg is how Corg executes code blocks. Being written in Rust, it cannot

A tool using binrw to read FFXIV data files

last-legend-dob A tool using binrw to read FFXIV data files. Mainly made to harvest the music from the game files for personal consumption, since it t

A tool that, like, screams at you when you say like

Dislike Do you, like,... dislike constantly saying "like" as much as I do? Then, like,... you've come the right place! This tool is like EXACTLY what

Cloud-Based Microservice Performance Profiling Tool

Revelio Systems Revelio Systems is a student startup sponsored by UT Austin's Inventors Program in partnership with Trend Micro. Team: Tejas Saboo, So

A tool to calculate mean and standard deviation from multiple tests using PageSpeed Insights API.

psi-sample PSI Test tool is an open source tool to assist web developers that runs Page Speed Insight test manually! Installing To install the psi-tes

Owner
Kevin Wan
go-zero.dev
Kevin Wan
Parses go-ethereum logs and pipes them to telegram

parrot Middleware that accepts logs via stdin and redirects them to Telegram, based on a configurable set of conditions.

null 6 Jul 25, 2022
A crude tool to convert from Bitwarden json format to lastpass

Pass-Merger A crude tool to convert from Bitwarden json format to lastpass. Steps to Deduplicate entries from Bitwarden Export all passwords from Chro

Usairim Isani 1 Jan 20, 2022
A repository full of manually generated hand curated JSON files, which contain the API Types that the Discord API returns.

Discord API Types A repository full of manually generated hand curated JSON files, which contain the API Types that the Discord API returns. Also did

Unofficial Discord Documentation 1 Sep 16, 2022
CLI tool that make it easier to perform multiple lighthouse runs towards a single target and output the result in a "plotable" format.

Lighthouse Groupie CLI tool that make it easier to perform multiple lighthouse runs towards a single target and output the result in a "plotable" form

Polestar 1 Jan 12, 2022
A CLI tool to convet Hex color code or RGB to color code, RGB, HSL and color name(if exists)

iro -色- A CLI tool to convert the hex color code or RGB to color code, RGB, HSL, color name(if exists, according to jonathantneal/color-names). Usage

Kyohei Uto 3 Dec 9, 2022
NSE is a rust cli binary and library for extracting real-time data from National Stock Exchange (India)

NSE Check out the sister projects NsePython and SaveKiteEnctoken which are Python & Javascript libraries to use the NSE and Zerodha APIs respectively

Techfane Technologies 4 Nov 28, 2022
CLI to create redirections in CloudFlare to Zoom meetings.

boteco boteco is a CLI to create redirections in CloudFlare to Zoom meetings. Requirements CloudFlare page rules In the domain you want to use, you ne

Eduardo Cuducos 3 Jan 3, 2023
Erlang Language Platform. LSP server and CLI.

Erlang Language Platform (ELP) Description ELP integrates Erlang into modern IDEs via the language server protocol. ELP was inspired by rust-analyzer.

WhatsApp 31 Aug 7, 2023
🦀 CLI for Cloudflare API 🦀

?? CLI️ to interact with Cloudflare APIs ?? An excuse to write some Rust ?? Under heavy development Setup Install Rust ?? curl --proto '=https' --tlsv

Dave Miller 3 Dec 15, 2023
🛠️ | System tool for all my lovers

<<<<<<< HEAD ?? love-fetch Original code ferris-fetch ?? ??️ System tool for all my lovers ?? How to install it ?? cargo install love-fetch License ??

Fabio Grimaldi 11 Jun 13, 2021