deluge/deluge/tests/test_log.py
Pedro Algarvio 3b00a7de59 Swhiched the old style logging, ie, a single logger for all logging output to several loggers. This brings the ability to tweak the logging levels for each of the loggers, ie, we can have the "deluge" logger be at the ERROR level while having "deluge.core" at the DEBUG level, meaning we will only see log message for all of the deluge loggers above the ERROR level while still having all messages above the DEBUG level for the "deluge.core" logger and it's children. This kind of tweak can be achieved by adding a file named "logging.conf" to deluge's config dir and this is explained on the deluge.log.tweak_logging_levels function.
Passing `-r` to the cli's while also passing `-l` will make the logfile rotate when reaching 5Mb in size. Three backups will be kept at all times.
All deluge's code is now using this new style logging along with the git hosted plugins. For other plugins not hosted by deluge, which still imports `LOG` as the logger, a deprecation warning will be shown explaining the required changes needed to use the new style logging. New plugins created by the `create_plugin` script will use the new logging facilities.
2010-12-06 11:20:22 +00:00

22 lines
648 B
Python

import logging
from twisted.internet import defer
from twisted.trial import unittest
from deluge.log import setupLogger
class LogTestCase(unittest.TestCase):
def setUp(self):
setupLogger(logging.DEBUG)
def tearDown(self):
pass
def test_old_LOG_deprecation_warning(self):
import warnings
from deluge.log import LOG
warnings.filterwarnings("ignore", category=DeprecationWarning,
module="deluge.tests.test_log")
d = defer.Deferred()
d.addCallback(LOG.debug, "foo")
self.assertFailure(d, DeprecationWarning)
warnings.resetwarnings()