diff options
-rw-r--r-- | ranger/__init__.py | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/ranger/__init__.py b/ranger/__init__.py index 4d8e4afe..9c4f8922 100644 --- a/ranger/__init__.py +++ b/ranger/__init__.py @@ -29,44 +29,9 @@ CACHEDIR = os.path.expanduser("~/.cache/ranger") USAGE = '%prog [options] [path]' VERSION = 'ranger-master %s\n\nPython %s' % (__version__, sys.version) -try: - ExceptionClass = FileNotFoundError -except NameError: - ExceptionClass = IOError -try: - LOGFILE = tempfile.gettempdir() + '/ranger_errorlog' -except ExceptionClass: - LOGFILE = '/dev/null' -del ExceptionClass # If the environment variable XDG_CONFIG_HOME is non-empty, CONFDIR is ignored # and the configuration directory will be $XDG_CONFIG_HOME/ranger instead. CONFDIR = '~/.config/ranger' -# Debugging functions. These will be activated when run with --debug. -# Example usage in the code: -# import ranger; ranger.log("hello world") - - -def log(*objects, **keywords): - """Writes objects to a logfile (for the purpose of debugging only.) - Has the same arguments as print() in python3. - """ - from ranger import arg - if LOGFILE is None or not arg.debug or arg.clean: - return - start = keywords.get('start', 'ranger:') - sep = keywords.get('sep', ' ') - end = keywords.get('end', '\n') - _file = keywords['file'] if 'file' in keywords else open(LOGFILE, 'a') - _file.write(sep.join(map(str, (start, ) + objects)) + end) - - -def log_traceback(): - from ranger import arg - if LOGFILE is None or not arg.debug or arg.clean: - return - import traceback - traceback.print_stack(file=open(LOGFILE, 'a')) - from ranger.core.main import main |