-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove logrus dependency, and add functional options to specify logger
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.
- Loading branch information
Showing
11 changed files
with
143 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.