Remove logrus dependency, and add functional options to specify logger #25
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.
This changeset removes the non-standard dependency to logrus, leaving
the only dependencies used in ansiterm and winterm as Go standard lib
packages. This also has the added benefit of removing a superfulous
package level variable (logger) in both ansiterm and winterm.
The changes made here introduce a backwards compatible change to the
API signatures of ansiterm.CreateParser and winterm.CreateWinEventHandler
by introducing the optional functional parameters pattern on both.
Additionally, both ansiterm and winterm packages receive a WithLogf()
func to specify a logging func to use, which can be passed a func
with the standard Printf signature, ie: func(string, ...interface{}).
This maintains the existing behavior of checking for the environment
variable DEBUG_TERMINAL, and writing to the files ansiParser.log and
winEventHandler.log. For ansiterm/winterm, if a logging func has been
specified as well as having DEBUG_TERMINAL set, then both the respective
*.log file and the passed logging func will receive the data.
Note: for simplicity purposes, the single instance in ansiterm where
there was a "warning" and "error" was logged has been changed to use the
single log, but the messages have been prefixed with WARNING and ERROR
respectively. This was done entirely for simplicity reasons.
Additionally 2 other logging calls have been removed where it was
prudent to do so, and one other logging line was moved to a different
location in order to avoid changing some utility funcs.