Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b230323

Browse files
author
luminougat
committed
Fixed logging for library usage
1 parent 04501fc commit b230323

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pyjfuzz/core/pjf_logger.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@ class PJFLogger(object):
2828

2929
@staticmethod
3030
def init_logger():
31-
logging.basicConfig(filename="pjf_{0}.log".format(time.strftime("%d_%m_%Y")), level=PYJFUZZ_LOGLEVEL)
3231
logger = logging.getLogger(__name__)
32+
logger.setLevel(level=PYJFUZZ_LOGLEVEL)
33+
filehandler = logging.FileHandler("pjf_{0}.log".format(time.strftime("%d_%m_%Y")))
34+
logger.addHandler(filehandler)
3335
sys.tracebacklimit = 10
3436

3537
def handle_exception(exc_type, exc_value, exc_traceback):
@@ -41,4 +43,4 @@ def handle_exception(exc_type, exc_value, exc_traceback):
4143
return
4244

4345
sys.excepthook = handle_exception
44-
return logger
46+
return logger

0 commit comments

Comments
 (0)