Commit 6491490f authored by Nelso Jost's avatar Nelso Jost

FIX: improved logger.py usage

parent 59d5a398
......@@ -24,7 +24,7 @@ help:
setup: venv
deb-install:
apt-install:
sudo apt-get install python3 python3-pip supervisor
sudo pip3 install virtualenv
......@@ -46,7 +46,7 @@ clean-venv:
rm -rf ${VENV}
run:
sudo ${VENV}/bin/python3 logger.py -v
sudo ${VENV}/bin/python3 logger.py
deploy:
sudo ${VENV}/bin/python3 deploy.py
......
......@@ -293,18 +293,23 @@ class Meteorologger:
return None
def setup_logging(self):
logging.basicConfig(
level=logging.DEBUG,
filename=self.EXECUTION_LOG_FILENAME,
format='%(asctime)s : %(levelname)s : %(message)s',
datefmt='%Y-%m-%d %H:%M:%S')
if self.verbose:
# logging.basicConfig(
# level=logging.DEBUG)
root = logging.getLogger('')
root.setLevel(logging.DEBUG)
console = logging.StreamHandler()
# console.setFormatter(logging.Formatter(
# fmt='%(asctime)s %(message)s', datefmt='%Y-%m-%d %H:%M:%S'))
console.setFormatter(logging.Formatter(
fmt='%(asctime)s : %(levelname)s : %(message)s',
datefmt='%Y-%m-%d %H:%M:%S'))
root.addHandler(console)
else:
logging.basicConfig(
level=logging.DEBUG,
filename=self.EXECUTION_LOG_FILENAME,
format='%(asctime)s : %(levelname)s : %(message)s',
datefmt='%Y-%m-%d %H:%M:%S')
def run(self):
'''
......@@ -362,4 +367,4 @@ class Meteorologger:
if __name__ == '__main__':
Meteorologger(verbose = True if '-v' in sys.argv else False).run()
Meteorologger(verbose = False if '-s' in sys.argv else True).run()
[program:{{ process_name }}]
command={{ base_dir }}/.venv/bin/python3 {{ base_dir }}/logger.py
command={{ base_dir }}/.venv/bin/python3 {{ base_dir }}/logger.py -s
directory={{ base_dir }}
user=root
autostart=true
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment