-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Move logger to separate file * Move logger to separate file
- Loading branch information
1 parent
1a5dc62
commit f564ab5
Showing
2 changed files
with
19 additions
and
17 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,18 @@ | ||
import logging | ||
import sys | ||
|
||
|
||
class OpenDbtLogger: | ||
_log = None | ||
|
||
@property | ||
def log(self) -> logging.Logger: | ||
if self._log is None: | ||
self._log = logging.getLogger(name="opendbt") | ||
if not self._log.hasHandlers(): | ||
handler = logging.StreamHandler(sys.stdout) | ||
formatter = logging.Formatter("[%(asctime)s] {%(filename)s:%(lineno)d} %(levelname)s - %(message)s") | ||
handler.setFormatter(formatter) | ||
handler.setLevel(logging.INFO) | ||
self._log.addHandler(handler) | ||
return self._log |