From 4c77e6b82055db6e0508fd8e11bbeb24f0f8513f Mon Sep 17 00:00:00 2001 From: berhsi Date: Sat, 27 Jul 2019 19:06:35 +0200 Subject: [PATCH] statusd.py: add logging messages to change_status() --- statusd.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/statusd.py b/statusd.py index 382d855..8fc7295 100755 --- a/statusd.py +++ b/statusd.py @@ -118,7 +118,9 @@ def change_status(raw_data, api): if data != False: status, timestamp = set_values(raw_data) if os.access(api, os.W_OK): + logging.debug('API file is writable') with open(api, 'w') as api_file: + logging.debug('API file open successfull') for line in data.splitlines(): if line.strip().startswith('"state":'): edit = True @@ -134,6 +136,8 @@ def change_status(raw_data, api): logging.error('Failed to write line to API file') logging.error('Line: {}'.format(line)) logging.error('{}'.format(e)) + logging.error('Failed to open API file') + logging.error('API file is not writable. No permissions?') logging.info('Status successfull changed to {}'.format(status)) return True return False