Skip to content

Commit

Permalink
moved code that made log directory same directory __init__.py into ge…
Browse files Browse the repository at this point in the history
…t_logger function since its only used by that function and its probably not a good idea since users may not have write access to their Python site packages directory
  • Loading branch information
coleslaw481 committed Nov 14, 2018
1 parent a297a5e commit 7a0e671
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions ndex2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,17 @@
import numpy as np
from ndex2cx.nice_cx_builder import NiceCXBuilder

root = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
log_path = os.path.join(root, 'logs')
if not os.path.exists(log_path):
os.makedirs(log_path)

node_id_lookup = {}
edge_id_counter = 0


def get_logger(name, level=logging.DEBUG):
# TODO Creating a logs directory within the package installation of Python is bad
root = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
log_path = os.path.join(root, 'logs')
if not os.path.exists(log_path):
os.makedirs(log_path)
logger = logging.getLogger(name)
logger.setLevel(level)

Expand Down

0 comments on commit 7a0e671

Please sign in to comment.