From 1b15bf25fb91e369873b8c9a5774da3f5ff4cbf0 Mon Sep 17 00:00:00 2001 From: John W Kerns Date: Fri, 1 Sep 2017 17:53:22 -0700 Subject: [PATCH] Added paramiko lodger creation --- checkmyip.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/checkmyip.py b/checkmyip.py index f346ef8..4bd5001 100644 --- a/checkmyip.py +++ b/checkmyip.py @@ -31,7 +31,10 @@ class log_management: self.logfile = "/etc/checkmyip/checkmyip.log" self._publish_methods() self.can_log = True - paramiko.util.log_to_file('/etc/checkmyip/ssh.log') + try: + paramiko.util.log_to_file('/etc/checkmyip/ssh.log') + except IOError: + self._create_log_dir() def _logger(self, data): logdata = time.strftime("%Y-%m-%d %H:%M:%S") + ": " + data + "\n" if self.can_log: