From 2a7828a1f52dd9546f6cffa7ee84fd1cfd6a24a2 Mon Sep 17 00:00:00 2001 From: Alessio Sergi Date: Sun, 22 Feb 2015 12:38:22 +0100 Subject: [PATCH] glances_logging: more Python 2.6 compatibility Minor cosmetic tweaks. --- glances/core/glances_logging.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/glances/core/glances_logging.py b/glances/core/glances_logging.py index 2900ae7c..b5e604bb 100644 --- a/glances/core/glances_logging.py +++ b/glances/core/glances_logging.py @@ -17,7 +17,7 @@ # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see . -"""Custom logging class""" +"""Custom logging class.""" import logging try: @@ -77,18 +77,19 @@ LOGGING_CFG = { def tempfile_name(): - """Return the tempfile name (full path)""" + """Return the tempfile name (full path).""" ret = os.path.join(tempfile.gettempdir(), 'glances.log') if os.access(ret, os.F_OK) and not os.access(ret, os.W_OK): - print("Warning: can't write logs to file {} (permission denied)".format(ret)) + print("WARNING: Couldn't write to log file {0}: (Permission denied)".format(ret)) ret = tempfile.mkstemp(prefix='glances', suffix='.tmp', text=True) - print("Create a new log file: {}".format(ret[1])) + print("Create a new log file: {0}".format(ret[1])) return ret[1] + return ret def glances_logger(): - """Build and return the logger""" + """Build and return the logger.""" temp_path = tempfile_name() _logger = logging.getLogger() LOGGING_CFG['handlers']['file']['filename'] = temp_path