summaryrefslogtreecommitdiffstats
path: root/deluge/log.py
Commit message (Collapse)AuthorAge
* [Core] Convert inlineCallbacks to maybe_coroutineChase Sterling2022-02-06
| | | | | | | | | | Make logging functions synchronous. They were not calling any async functions, and wrapping them in maybe_coroutine caused reactor to be imported before gtkui could install the gtk reactor. Closes: https://github.com/deluge-torrent/deluge/pull/353
* [Log] Fix crash logging to Windows protected folderdoadin2022-02-03
| | | | | | | | | | | | | | | Have the log dir be a protected windows folder and Deluge crashes. Windows blocks access to the dir and so it fails. It will fail trying to write to any protected folder. Should probably just pass on the error maybe and maybe log to stdout and log a message saying access was blocked or something. .\deluge-debug -L debug -l E:\Documents\deluge.log ... Failed to execute script 'deluge-debug-script' due to unhandled exception! Closes: https://dev.deluge-torrent.org/ticket/3502 Closes: https://github.com/deluge-torrent/deluge/pull/358
* Upgrade codebase with pyupgrade (>=py3.6)DjLegolas2021-12-29
| | | | | | | | Added pyupgrade utility with manual stage to pre-commit and run on all files. Ref: https://github.com/asottile/pyupgrade Closes: deluge-torrent/deluge#326
* Remove all Python 2 supportdeluge-2.1.0.dev0DjLegolas2021-12-28
| | | | | | | | | * Removed all __future__ imports from code * Removed all six dependencies * Removed all future_builtins imports * Removed all Python 2 related code Closes: deluge-torrent/deluge#325
* [Lint] Fix spelling mistakesCalum Lind2021-09-21
| | | | | | | A quick fix of some of the mistakes caught by codespell. Updated readme with new IRC server Useful to add it as part of linting checks.
* Ignore TypeError with custom Twisted loggingCalum Lind2021-07-25
| | | | | | | | | | | | The modification of Python logging _findCaller args in Python 3.8 raises TypeError in our custom Twisted Logger with Twisted <= 19 versions. The actual issue for the custom logger was fixed in 18.9 so added a version check to avoid usage. Refs: - https://twistedmatrix.com/trac/ticket/7927 - https://github.com/twisted/twisted/commit/6b894744e4d2439c1a4436d1e0e0b2a6cdff68e4
* [Logging] Fix findCaller with unknown sourceminus2019-11-19
| | | | | In case no source was found, a 3-tuple was returned instead of a 4-tuple in Python 3
* [Logging] Fix Python 3.8 compatibilityminus2019-11-19
| | | | | | | Deluge's logger class extends Python's `logging.Logger`. Since Python 3.8, it takes an additional argument `stacklevel`. The implementation in Deluge does not support that. Work around the problem by ignoring additional arguments.
* Minor updates to log.pySerg2019-05-20
|
* [Logging] Fix line numbers missing on Python 3Calum Lind2019-05-20
| | | | | The findCaller method returns a 4-element tuple on Python 3 whereas it was a 3-element tuple on Python 2.
* [Lint] Use Black to auto-format codeCalum Lind2018-10-03
| | | | | | | | | | | | | | | | | The move to using auto-formatter makes it easier to read, submit and speeds up development time. https://github.com/ambv/black/ Although I would prefer 79 chars, the default line length of 88 chars used by black suffices. The flake8 line length remains at 120 chars since black does not touch comments or docstrings and this will require another round of fixes. The only black setting that is not standard is the use of double-quotes for strings so disabled any formatting of these. Note however that flake8 will still flag usage of double-quotes. I may change my mind on double vs single quotes but for now leave them. A new pyproject.toml file has been created for black configuration.
* [Py2to3] Fix log.warn deprecation warningCalum Lind2018-09-14
|
* Fix files to pass new Flake8 checkersCalum Lind2018-06-01
| | | | | | | | | | | Some new flake8 checkers were added so fix these new warnings and any issues uncovered. Use add-trailing-comma to fix missing trailing commas. It does not format it as well as I would like however it was fast to change and helps with git changes in future. Removed pylint from tox due to large number of warnings.
* [Python3] Fixes to make code backward compatibleCalum Lind2017-06-05
| | | | | | | | | | * Continuation of updating code to Python 3 with Python 2 fallback. * Using io.open allows files to be encoded and decoded automatically on write and read. This maintains the python boundaries of unicode in code and bytes for output/files so less explicit encoding or decoding. * io.StringIO is the replacement for StringIO and will only accept unicode strings. * io.BytesIO is used where bytes output is required by the enclosing method. * Update bencode for full compatibility.
* [Py2to3] Force unicode_literals and fix related issuesCalum Lind2017-02-22
| | | | | | | | | | | | | | | | | | * Added `from __future__ import unicode_literals` to every file so now all strings in code are forced to be unicode strings unless marked as byte string `b'str'` or encoded to byte string `'str'.encode('utf-8')`. This is a large change but we have been working towards the goal of unicode strings passed in the code so decoding external input and encoding output as byte strings (where applicable). Note that in Python 2 the `str` type still refers to byte strings. * Replaced the use of `str` for `basestring` in isinstance comparison as this was the original intention but breaks code when encoutering unicode strings. * Marked byte strings in gtkui as the conversion to utf8 is not always handled, mostly related to gobject signal names.
* [Lint] Fix files to pass Flake8 v3.2.0Calum Lind2016-11-17
|
* [Lint] Quote cleanupCalum Lind2016-11-17
|
* [Lint] Refactor flake8 noqa's and add msg numbersCalum Lind2016-11-04
| | | | | | From pep8-naming: * N802: function name should be lowercase * N803: argument name should be lowercase
* [Lint] Add flake8-quotes to tox and fix bad quotesCalum Lind2016-11-04
|
* [Lint] Convert all python double quotes to single quotesCalum Lind2016-11-03
| | | | | | | | | | | | | | | | | | * A rather disruptive change but for a few reasons such as easier to read, easier type, keep consistent and javascript code uses single quotes. * There are a few exceptions for the automated process: * Any double quotes in comments * Triple double quotes for docstrings * Strings containing single quotes are left e.g. "they're" * To deal with merge conflicts from feature branches it is best to follow these steps for each commit: * Create a patch: `git format-patch -1 <sha1>` * Edit the patch and replace double quotes with single except those in comments or strings containing an unescaped apostrophe. * Check the patch `git apply --check <patchfile>` and fix any remaining issues if it outputs an error. * Apply the patch `git am < <patchfile>`
* [#1119] [Console] ignore logging when no file specifiedbendikro2016-10-30
| | | | | | Add wrapper around the stream passed to the loggers streamhandler when no log file is specified. Console in interactive mode now ignores the log output with no logfile specified.
* [#2850] Fix duplicate ui log entriesCalum Lind2016-10-25
|
* [Tests] Improve UI entry script testsbendikro2016-10-18
| | | | * Added parameter log.setup_logger to prevent output noise in unit tests
* [#2889] Fixes for 'Too many files open' errorCalum Lind2016-10-18
| | | | | | | | * Ensure all file descriptors are closed. Using the with statement ensures closure. * The main problem was with thousands of unclosed file desciptors from tracker_icons mkstemp. * Use a prefix 'deluge_ticon.' to identify created tracker_icon tmp files.
* [Base] Updated fix for missing trace with new twisted loggerbendikro2016-05-09
| | | | Includes a commented out test to replicate the issue.
* [Lint] Remove warnings from .pylintrcbendikro2016-05-06
| | | | | | | Remove warnings from ignore list in .pylintrc: * super-on-old-class * pointless-except * non-parent-init-called
* [Base] Add custom log observer to handle twisted errorsbendikro2016-05-06
| | | | | | | | | | | | For some reason errors are logged by twisted as 'Unhandled error in Deferred', but without a following stacktrace. This can happen in a deferred callback that e.g. raises an ImportError. Without an excplicit error handler for a deferred to log such errors, finding the error can be very tricky. Fix this by using a custom twisted.python.log.PythonLoggingObserver, PythonLoggingObserver, that also logs the traceback in addition to the error message.
* [#2808] Fix: Deluge Log File Not Working as Intendedbendikro2016-04-20
|
* [#1949] [UI] Allow setting max size for rotating log filebendikro2016-04-18
|
* [Tests] Improved common.start_corebendikro2016-04-10
| | | | | | | * Replace Popen with reactor.spawnProcess and read process output with twisted.internet.protocol.ProcessProtocol * Implement support for running custom script code * Now logs to stdout instead of stderr when not logging to file
* [Core] Add line numbers to non-dev loggingCalum Lind2015-11-12
|
* [Lint] Code cleanup for PyLint run by prospector toolCalum Lind2015-10-30
| | | | | | | | * Fix for pluginmanager multiple inheritance which in this case is using super incorrectly. * Explicitly disable pylint 'pointless-except' and 'super-on-old-class' that prospector tool somehow runs. * Make __all__ a tuple to supress pep257 warning. * Add a noqa for older versions of pyflakes.
* [Lint] Cleanup code to pass PyLint Warning categoryCalum Lind2015-10-30
| | | | | | | | | | | | | | | | Selected Warning messages disabled in pylintrc: * unused-argument: Quite a large and disruptive change if enabled. * broad-except: Most required in-depth investigation to determine type. * fixme: Not important * protected-access: Complicated to fix * import-error: Too many false-positives * unidiomatic-typecheck: Should be fixed in the next round of checks. * unused-variable: Again large and disruptive changes. * global-statement: Most usage is required. * attribute-defined-outside-init: Should be fixed in next round of checks. * arguments-differ: Possible false-positives, needs revisited. * no-init, non-parent-init-called, super-init-not-called: False-positives? * signature-differs: False-positives?
* Correction for Flake8 func rename in log.pyCalum Lind2014-09-23
| | | | Broke the retrieval of logging lines.
* Flake8 pass of entire codebaseCalum Lind2014-09-19
| | | | * Use the inline '# NOQA' to supress N802 lower-case warnings
* Flake8 core and common filesCalum Lind2014-09-03
| | | | | | * Added N802 to flake8 ignore as certain inherited funcs cannot be changed to lowercase and this unresolved warning hides other errors/warnings. * Include new header
* Sort/prettify imports with isortCalum Lind2014-09-03
|
* Start with a bigger width.Pedro Algarvio2011-07-07
|
* Trigger a deprecation warning for code calling "getPluginLogger".Pedro Algarvio2011-06-04
| | | | | Since the plugins namespace was merged into master, calling "logging.getLogger(__name__)" will result in a properly named logger for plugins which will allow logging filtering. The previous workaround "getPluginLogger()", is now deprecated.
* Now that the plugin's namespace is in use, make the plugins get their own ↵Pedro Algarvio2011-06-03
| | | | logger instead of using `getPluginLogger()`
* Move the log level to the left of the module because this field is a fixed ↵Andrew Resch2011-06-02
| | | | width and its easier to read this way
* Include our custom lower log levels into python's logging.Pedro Algarvio2011-05-17
|
* Add "none" as a log level to support quieting the logging messages. Refs #1470.Pedro Algarvio2011-01-02
|
* Fix #1470.Pedro Algarvio2011-01-02
|
* On a 64bit platform with old plugins, the deprecation code was unable to ↵Pedro Algarvio2011-01-01
| | | | find out which was the caller module. This might also happen on other platforms although I was unable to reproduce it on x86. Anyway, handle it cleanly.
* Let log files be a little bigger, 50Mb is not that much anyway.Pedro Algarvio2010-12-28
|
* Added missing import.Pedro Algarvio2010-12-28
| | | | Removed log message that caused error. It was never logged anyway, even on the master branch before the improved logging branch was created.
* Fix `tweak_logging_levels()`.Pedro Algarvio2010-12-07
|
* Fix bug introduced in previous commit.Pedro Algarvio2010-12-06
|
* Make use of `logging.handlers.WatchedFileHandler` if deluge is running on ↵Pedro Algarvio2010-12-06
| | | | python 2.6.