cirruslabs / echelon Goto Github PK
View Code? Open in Web Editor NEWhierarchical progress bars in terminal on steroids
License: MIT License
hierarchical progress bars in terminal on steroids
License: MIT License
Seems there is an issue when terminal window doesn't have too many lines available. Reported from this Reddit comment:
Ah echelon tries to keep the job levels at the top of the currently-visible portion of the console, this is interesting. This only is an issue in case there are too many log lines. This makes the output very ugly though, apart from the last few lines. Just try the demo with passing false to all log.Finish calls.
Example for the issue:
๐ Job 1 37s
๐ Job 1 38s
โ Job 4 8.0s
๐ Job 1 39s
Doing very important jobs! Completed 25/100...
๐ Job 1 40s
๐ Job 1 41s
๐ Job 1 42s
๐ Job 1 43s
Doing very important jobs! Completed 87/100...
๐ Job 1 44s
๐ Job 1 45s
๐ Job 1 46s
๐ Job 1 47s
๐ Job 1 48s
๐ Job 1 49s
โ Job 8 9.0s
Using current NewSimpleRenderer
, if we pipe or log it to file it will print the ANSI color codes.
So for my use case, I want to use NewInteractiveRenderer
in my development and use NewSimpleRenderer
in the production but it will print ANSI color codes in the log.
Related PR #18.
Right now it's only possible to configure colors and progress indicator. Once there are more cases of echelon usage we need think of a generic way for customization of scope statuses. (replace โ and โ with something different)
I have some unit tests on some code that uses echelon and it spit this out with -race
.
Looks like the len(node.Children)
at https://github.com/cirruslabs/echelon/blob/master/renderers/internal/node/echelone_node.go#L134 needs to be protected by mutex.
==================
WARNING: DATA RACE
Write at 0x00c0001386a8 by goroutine 10:
github.com/cirruslabs/echelon/renderers/internal/node.(*EchelonNode).FindOrCreateChild()
/data/app/kochiku-worker/go/pkg/mod/github.com/cirruslabs/[email protected]/renderers/internal/node/echelone_node.go:194 +0x2bd
github.com/cirruslabs/echelon/renderers.findScopedNode()
/data/app/kochiku-worker/go/pkg/mod/github.com/cirruslabs/[email protected]/renderers/interactive.go:43 +0xb0
github.com/cirruslabs/echelon/renderers.(*InteractiveRenderer).RenderScopeStarted()
/data/app/kochiku-worker/go/pkg/mod/github.com/cirruslabs/[email protected]/renderers/interactive.go:49 +0x67
github.com/cirruslabs/echelon.(*Logger).streamEntries()
/data/app/kochiku-worker/go/pkg/mod/github.com/cirruslabs/[email protected]/logger.go:46 +0x182
Previous read at 0x00c0001386a8 by goroutine 9:
github.com/cirruslabs/echelon/renderers/internal/node.(*EchelonNode).fancyTitle()
/data/app/kochiku-worker/go/pkg/mod/github.com/cirruslabs/[email protected]/renderers/internal/node/echelone_node.go:134 +0x82
github.com/cirruslabs/echelon/renderers/internal/node.(*EchelonNode).Render()
/data/app/kochiku-worker/go/pkg/mod/github.com/cirruslabs/[email protected]/renderers/internal/node/echelone_node.go:100 +0x6a
github.com/cirruslabs/echelon/renderers.(*InteractiveRenderer).DrawFrame()
/data/app/kochiku-worker/go/pkg/mod/github.com/cirruslabs/[email protected]/renderers/interactive.go:94 +0x1aa
github.com/cirruslabs/echelon/renderers.(*InteractiveRenderer).StartDrawing()
/data/app/kochiku-worker/go/pkg/mod/github.com/cirruslabs/[email protected]/renderers/interactive.go:75 +0x74
=================
There is no logic in NewInteractiveRenderer()
that depends on out
being a file, but unfortunately this can't be changed without a 2.x release. Can an additional function be added to handle this case? I can submit the PR for it
func NewInteractiveRenderer2(out io.Writer, rendererConfig *config.InteractiveRendererConfig) *InteractiveRenderer
Thank you.
That is all ๐
I am relatively new to Go, and am having trouble understanding how to use the SimpleRenderer. Can you please provide some example code?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.