Skip to content

Commit

Permalink
cleaner Logger __init__
Browse files Browse the repository at this point in the history
domluna committed Dec 8, 2017
1 parent 74616bc commit 8dafcd4
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions logger.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
# -*- coding: utf-8 -*-
import numpy as np
import os


class Logger:

def __init__(self, *args):
if len(args) == 0:
filename = os.path.join("Logs", "NavLog.txt")
if len(args) == 1:
filename = os.path.join("Logs", args[0])
elif len(args) == 2:
filename = os.path.join(args[0], args[1])
def __init__(self, directory='Logs', filename='NavLog.txt'):
filepath = os.path.join(directory, filename)
print(filepath)
if not os.path.exists(filepath):
os.makedirs(os.path.dirname(filepath))

self.log = open(filename, 'w')
self.log = open(filepath, 'w')
self.num_data = 0
self.open = True

0 comments on commit 8dafcd4

Please sign in to comment.