chg: small improvments in the logging system

pull/141/head
Raphaël Vinot 2017-11-07 19:10:54 -08:00
parent f1a88f460e
commit 4512a4eaca
2 changed files with 4 additions and 3 deletions

View File

@ -2,7 +2,7 @@ __version__ = '2.4.81.2'
import sys import sys
import logging import logging
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
FORMAT = "[%(filename)s:%(lineno)s - %(funcName)s() ] %(message)s" FORMAT = "%(levelname)s [%(filename)s:%(lineno)s - %(funcName)s() ] %(message)s"
logging.basicConfig(stream=sys.stderr, level=logging.WARNING, format=FORMAT) logging.basicConfig(stream=sys.stderr, level=logging.WARNING, format=FORMAT)
try: try:

View File

@ -95,8 +95,9 @@ class PyMISP(object):
self.resources_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'data') self.resources_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'data')
if out_type != 'json': if out_type != 'json':
raise PyMISPError('The only output type supported by PyMISP is JSON. If you still rely on XML, use PyMISP v2.4.49') raise PyMISPError('The only output type supported by PyMISP is JSON. If you still rely on XML, use PyMISP v2.4.49')
if debug is not None: if debug:
logger.warning('debug is deprecated, configure logging in your script: import logging; logging.getLogger(\'pymisp\').setLevel(logging.DEBUG)') logger.setLevel(logging.DEBUG)
logger.info('To configure logging in your script, leave it to None and use the following: import logging; logging.getLogger(\'pymisp\').setLevel(logging.DEBUG)')
try: try:
# Make sure the MISP instance is working and the URL is valid # Make sure the MISP instance is working and the URL is valid