-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #907 from serengil/feat-task-0612-logger
feat-task-654-use-custom-logger
- Loading branch information
Showing
25 changed files
with
225 additions
and
115 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
test: | ||
cd tests && python -m pytest unit_tests.py -s --disable-warnings | ||
|
||
lint: | ||
python -m pylint deepface/ --fail-under=10 |
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
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,39 @@ | ||
import os | ||
import logging | ||
|
||
# pylint: disable=broad-except | ||
class Logger: | ||
def __init__(self, module=None): | ||
self.module = module | ||
log_level = os.environ.get("DEEPFACE_LOG_LEVEL", str(logging.INFO)) | ||
try: | ||
self.log_level = int(log_level) | ||
except Exception as err: | ||
self.dump_log( | ||
f"Exception while parsing $DEEPFACE_LOG_LEVEL." | ||
f"Expected int but it is {log_level} ({str(err)})" | ||
) | ||
self.log_level = logging.INFO | ||
|
||
def info(self, message): | ||
if self.log_level <= logging.INFO: | ||
self.dump_log(message) | ||
|
||
def debug(self, message): | ||
if self.log_level <= logging.DEBUG: | ||
self.dump_log(f"🕷️ {message}") | ||
|
||
def warn(self, message): | ||
if self.log_level <= logging.WARNING: | ||
self.dump_log(f"⚠️ {message}") | ||
|
||
def error(self, message): | ||
if self.log_level <= logging.ERROR: | ||
self.dump_log(f"🔴 {message}") | ||
|
||
def critical(self, message): | ||
if self.log_level <= logging.CRITICAL: | ||
self.dump_log(f"💥 {message}") | ||
|
||
def dump_log(self, message): | ||
print(message) |
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.