forked from HHS/TANF-app
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* - Added custom formatter - Added specific log config for parsing - Added logging throughout parsing * - Addding tty to docker - Update colors * - Added more logging based on discussion. * - Small updates to logs/color * - Fix lint errors * - Added repr/str for datafile - Updated repr/str for parsererror - UPdated based on review comments * - fix lint errors * - Updated based on review comments * - Updating buildpack * Revert "- Updating buildpack" This reverts commit 9854dcb. * - extra logging message * Revert "- extra logging message" This reverts commit 8f19e95. --------- Co-authored-by: Alex P <[email protected]>
- Loading branch information
1 parent
d66ec43
commit 539007a
Showing
10 changed files
with
107 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
"""Contains core logging functionality for TDP.""" | ||
|
||
import logging | ||
|
||
class ColorFormatter(logging.Formatter): | ||
"""Simple formatter class to add color to log messages based on log level.""" | ||
|
||
BLACK = '\033[0;30m' | ||
RED = '\033[0;31m' | ||
GREEN = '\033[0;32m' | ||
BROWN = '\033[0;33m' | ||
BLUE = '\033[0;34m' | ||
PURPLE = '\033[0;35m' | ||
CYAN = '\033[0;36m' | ||
GREY = '\033[0;37m' | ||
|
||
DARK_GREY = '\033[1;30m' | ||
LIGHT_RED = '\033[1;31m' | ||
LIGHT_GREEN = '\033[1;32m' | ||
YELLOW = '\033[1;33m' | ||
LIGHT_BLUE = '\033[1;34m' | ||
LIGHT_PURPLE = '\033[1;35m' | ||
LIGHT_CYAN = '\033[1;36m' | ||
WHITE = '\033[1;37m' | ||
|
||
RESET = "\033[0m" | ||
|
||
def __init__(self, *args, **kwargs): | ||
self._colors = {logging.DEBUG: self.CYAN, | ||
logging.INFO: self.GREEN, | ||
logging.WARNING: self.YELLOW, | ||
logging.ERROR: self.LIGHT_RED, | ||
logging.CRITICAL: self.RED} | ||
super(ColorFormatter, self).__init__(*args, **kwargs) | ||
|
||
def format(self, record): | ||
"""Format the record to be colored based on the log level.""" | ||
return self._colors.get(record.levelno, self.WHITE) + super().format(record) + self.RESET |
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