Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: reference workflowpattern package to add workflow filtering #1709
feature: reference workflowpattern package to add workflow filtering #1709
Changes from 5 commits
9d94a76
2a582fd
5f88d0a
e7702b9
9d7a369
772062e
64bef7a
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably want a logrus tracewriter for consistent logging
it shoud respect
--json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello. I'm looking back at this PR now.
It doesn't look like there's any implementation of your
workflowpattern.TraceWriter
interface in the Logrus package - their Info function uses theInfo(args ...interface{})
stub.The
workflowpattern.TraceWriter
Interface doesn't seem to be used anywhere else in nektos/act - should the interface be altered to comply with theLogrus.Info(args ...interface{})
function stub, or did you initially plan to create an implementation ofworkflowpattern.TraceWriter
that wraps around Logrus?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wrote workflow pattern in a way to avoid any non golang stdlib.
For example if we want to change the logging system, this package doesn't need to change.
fmt.Sprintf can create a string you can pass to logrus similar to what the default impl. does.
I expect the caller of the package to create a small adapter struct.
I can create a logrus adapter for you, it's not time expensive.
Maybe just add an interface adapter for logrus like LogrusLogger(some custom interface with the logging signatures of logrus) returns the existing interface without logrus import.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually we can just append a f to Info in this package and it is an exact match of a logrus logger instance
Logrus.Infof should not be used, use the logger instance of act. Not a static wrapper of the standard logger
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated the
TraceWriter
interface so thatInfo
is nowInfof
.Apologies if I'm being a bit dense, but I'm not sure that I'm following you. Do you want me to do dependency inversion here? As in - specify the
TraceWriter
interface as a parameter for my functions/as an attribute on theWorkflow
struct (which my functions receive), so that I can then pass in a concrete Logrus instance (since it now lines up with the interface) from upstream?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean pass
common.Logger(ctx)
to the workflow pattern package as Tracewriter if possible (it returns a logrus logger object).The logrus package has Infof Both as an interface Method and as an static package function, but the logrus interface has name FieldLogger/Ext1Logger not logrus.
Sorry for the confusion.
You can keep logrus interfaces in all other packages, because they are already using logrus directly.