A logger that spins up a web browser and sends logs in real-time via websocket.
- If you don't already have it, install a recent version of Go.
- If you are on Windows, you'll want a bash shell.
- I use git-bash, which comes with Git for Windows.
- In bash,
cdinto the path where you cloned this repo, then run./build-dev.sh, which does the following:- runs tests
- builds cmd/example, writing the output to
local/example[.exe].
- Run
local/example[.exe], then point a web browser atlocalhost:8080
I've also been playing with Air for hot-reloading. I created my own fork/branch to pull in an unmerged PR, and added a quick install script.
- mark a field as "global", showing it in a static position, and not after the log lines where it appears
- should this be on the server's side or a client ui?
- structured data filters
- add filter for specific fields that must exist
- add way to filter on field values (exact, and ranges for numbers)
- resizable column widths
- Add options to periodically send memory/gc stats to the web viewer
- maybe a generic system for adding named fields and displaying them on the sidebar?
- Instead of mirroring frog's interface, maybe make it a module that requires frog to work?
- add multiple filters that can be quickly switched between
- add highlights in addition to filters, for adding custom background colors to rows containing specific terms
cleanup http server and any open connections on Close()add visually distinct formatting for fatal log linessave captured logs to text ndjson fileadd toggles for log levelsadd simple text filter (or regex?)"currently visible" -> "active lines", then add "visible" as readonly display of actually visible linesauto reload on connection if web page found to be out of datedisplay structured data ("fields")- infinity scroll
// source: https://www.javascripttutorial.net/dom/css/check-if-an-element-is-visible-in-the-viewport/ const isInViewport = (element) => { const rect = element.getBoundingClientRect(); return ( rect.top >= 0 && rect.left >= 0 && rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && rect.right <= (window.innerWidth || document.documentElement.clientWidth) ); } scroll_parent.addEventListener('scroll', () => { let str = '----- '; let nodes = log_line_parent.children; for (let i = 0; i < nodes.length; i++) { if (isInViewport(nodes[i])) { str += '#'; } else { str += '_'; } } dlog(str); }, { passive: true }, );
See LICENSE.txt for the current license. License may change in the future.
Thanks to the MIT licensed software that I use, including:
* Halfmoon JS
* Version: 1.1.1
* https://www.gethalfmoon.com
* Copyright, Halfmoon UI
* Licensed under MIT (https://www.gethalfmoon.com/license)
* FileSaver.js
* A saveAs() FileSaver implementation.
*
* By Eli Grey, http://eligrey.com
*
* License : https://github.com/eligrey/FileSaver.js/blob/master/LICENSE.md (MIT)
* source : http://purl.eligrey.com/github/FileSaver.js