GitHub - EmNudge/logpipe: Inspect your logs
source link: https://github.com/EmNudge/logpipe
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Repository files navigation
Logpipe
Get clarity on development logs
Kapture.2024-04-18.at.23.31.58.mp4Checkout the docs or see it in action in this online demo!
Installation
There is no build step in this codebase, so you can install it directly from git if you want.
npm i -g https://github.com/EmNudge/logpipe.git
# or
npm i -g @emnudge/logpipe
Usage
$ some-other-program | logpipe
> server running on http://localhost:7381
Then go to the URL and inspect away!
logpipe
parameters:
--port <number>
- Choose a specific port (instead of random). Useful for command runners like
nodemon
.
- Choose a specific port (instead of random). Useful for command runners like
--title <some text>
- Title for the page. Useful if you have multiple
logpipe
s open at once.
- Title for the page. Useful if you have multiple
Redirecting Stderr
Many programs will output their logs to stderr instead of stdout. If logpipe
is not capturing anything and you still see output in your terminal, this is probably what's happening.
You can use bash redirection to fix this.
my-program 2>&1 | logpipe # note the "2>&1"
Motivation
When dealing with various codebases in development, you'll come across perhaps hundreds of logs per minute. Some of these are supposed to be useful. As it's just sending out unstructured text, it can be hard to find what you want. Furthermore, it often lacks syntax highlighting. It is hard to know where one log ends and another starts.
In contrast, something like your browser's dev console allows filtering, highlighting, and inspection of "unstructured" logs. The goal is to supercharge this to be used for any system that outputs any kind of logs.
Behavior
This is a tool meant primarily for development. Therefore, the intention is to value assistance over correctness.
This allows us the following interesting features:
- Logpipe will syntax highlight logs that previously had no syntax highlighting.
- It will automatically apply tags to logs for you to search over.
- It will attempt to group logs that seem related (based on indentation or language grammar)
It also allows us to live-filter logs while retaining the log state - something already present in most log inspection tools.
Development
It has been helpful to use something like nodemon
during development to automatically restart the server when the code changes.
There is a file called out.js
which is purely used to simulate logs like in a regular application.
out.js
parameters:
--delay <number>
- delay in milliseconds between each log
--iterations <number>
- number of iterations to run (default Infinity)
nodemon --exec 'node out.js | node index.mjs -p 7280' -e ts,html,js,mjs,css
Similar Tools (Alternatives)
The primary goal of logpipe is to simplify viewing and searching real-time development logs. If this is not your exact use-case, you may be better served by other tools.
For a direct CLI-specific alternative, I quite like tailspin.
For viewing structured logs in the CLI, check out klp or lnav.
Web UIs are going to be the easiest for viewing logs individually and filtering on them. logscreen and logdy both exist in this category, but neither applies syntax highlighting or function well with unstructured logs.
Logpipe seems to exist solely in this niche of "live webui view on unstructured logs with automatic syntax highlighting". If you find another tool that fits into this category, file an issue and I'll add it to this section.
Recommend
-
51
README.md
-
43
Ever tried inspecting the network traffic of any page and validating its response values? It's possible in Capybara if you are using the Poltergeist driver. The Poltergeist driver is a PhantomJS driver for Capyba...
-
36
Post Syndicated fromJeff Barr original https://aws.amazon.com/blogs/aws/new-vpc-traffic-mirroring/ Running a complex network is not an e...
-
37
A hidden game for your web inspectora little web experiment that lets you play SNAKE in your browser's web inspector.wowee.i hope you enjoy it !code available for the l...
-
8
Inspect a project carefully before you leap onto it One time, I was becoming bored at my day job and went looking for other things to do which still involved programming. I figured maybe I could find something which could use my...
-
3
使用 Ionic 开发 Android App 时,论调试工具,还是要数 Chrome Inspect 最方便。但是这个工具的常见问题就是白屏了,我就曾遇到过几次,但都解决了。我近期需要对 Ionic1(历史原因,还没升级到 Ionic5)的旧 App 进行功能调整,再次遇到了白屏问题,就有些诡...
-
13
By Kayce Basques Technical Writer, Chrome DevTools...
-
8
Inspect Element As A Way To Feed Your Curiosity 07 Apr 2021 One of the best gifts we have as front-end developers is the ability to see how something is implemented by simply inspecting a website and see how the CSS...
-
3
Inspect Your Webapp in a Live Environment Interactively with GroovyConsole September 27, 2011 Have you ever needed to check t...
-
2
Ctx Echo Returns a map of all key-values stored inside a context. It only works with context.Context package. Installation Using go get: go get github.com/AmirSoleimani/[email protected]
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK