Now that the plugin's namespace is in use, make the plugins get their own logger instead of using `getPluginLogger()`

This commit is contained in:
Pedro Algarvio 2011-06-03 23:10:43 +01:00
parent 84c5078667
commit 13db148a11
46 changed files with 104 additions and 103 deletions

View File

@ -232,6 +232,8 @@ def setLoggerLevel(level, logger_name=None):
def getPluginLogger(logger_name):
if 'deluge.plugins.' in logger_name:
return logging.getLogger(logger_name)
return logging.getLogger("deluge.plugin.%s" % logger_name)

View File

@ -40,7 +40,7 @@
from deluge._libtorrent import lt
import os
from deluge.log import getPluginLogger
import logging
from deluge.plugins.pluginbase import CorePluginBase
import deluge.component as component
import deluge.configmanager
@ -50,7 +50,7 @@ from twisted.internet.task import LoopingCall, deferLater
from twisted.internet import reactor
from deluge.event import DelugeEvent
log = getPluginLogger(__name__)
log = logging.getLogger(__name__)
DEFAULT_PREFS = {
"watchdirs":{},

View File

@ -38,8 +38,7 @@
#
import gtk
from deluge.log import getPluginLogger
import logging
from deluge.ui.client import client
from deluge.ui.gtkui import dialogs
from deluge.plugins.pluginbase import GtkPluginBase
@ -49,7 +48,7 @@ import os
from common import get_resource
log = getPluginLogger(__name__)
log = logging.getLogger(__name__)
class IncompatibleOption(Exception):
pass

View File

@ -37,14 +37,14 @@
# statement from all source files in the program, then also delete it here.
#
from deluge.log import getPluginLogger
import logging
from deluge.ui.client import client
from deluge import component
from deluge.plugins.pluginbase import WebPluginBase
from common import get_resource
log = getPluginLogger(__name__)
log = logging.getLogger(__name__)
class WebUI(WebPluginBase):

View File

@ -36,6 +36,7 @@
import os
import time
import logging
from datetime import datetime, timedelta
from wsgiref.handlers import format_date_time
from urlparse import urljoin
@ -45,7 +46,7 @@ from twisted.internet.task import LoopingCall
from twisted.internet import threads, defer
from twisted.web import error
from deluge.log import getPluginLogger
from deluge.plugins.pluginbase import CorePluginBase
import deluge.component as component
import deluge.configmanager
@ -58,7 +59,7 @@ from readers import ReaderParseError
# TODO: check return values for deferred callbacks
# TODO: review class attributes for redundancy
log = getPluginLogger(__name__)
log = logging.getLogger(__name__)
DEFAULT_PREFS = {
"url": "http://deluge-torrent.org/blocklist/nipfilter.dat.gz",

View File

@ -33,17 +33,17 @@
#
#
import logging
from datetime import datetime
import gtk
from deluge.log import getPluginLogger
from deluge.ui.client import client
import deluge.component as component
import deluge.common
from deluge.plugins.pluginbase import GtkPluginBase
import common
log = getPluginLogger(__name__)
log = logging.getLogger(__name__)
class GtkUI(GtkPluginBase):
def enable(self):

View File

@ -3,13 +3,12 @@
# Distributed under the same terms as Deluge
##
import logging
from exceptions import Exception
from struct import unpack
import gzip, socket
from deluge.log import getPluginLogger
log = getPluginLogger(__name__)
log = logging.getLogger(__name__)
class PGException(Exception):
pass

View File

@ -36,12 +36,12 @@
import os
from deluge.log import getPluginLogger
import logging
from deluge.ui.client import client
from deluge import component
from deluge.plugins.pluginbase import WebPluginBase
log = getPluginLogger(__name__)
log = logging.getLogger(__name__)
#import deluge.ui.webui.lib.newforms_plus as forms

View File

@ -33,13 +33,13 @@
#
#
from deluge.log import getPluginLogger
import logging
from deluge.plugins.pluginbase import CorePluginBase
import deluge.component as component
import deluge.configmanager
from deluge.core.rpcserver import export
log = getPluginLogger(__name__)
log = logging.getLogger(__name__)
class Core(CorePluginBase):
def enable(self):

View File

@ -34,14 +34,14 @@
#
import gtk
import logging
from deluge.log import getPluginLogger
from deluge.ui.client import client
from deluge.plugins.pluginbase import GtkPluginBase
import deluge.component as component
import deluge.common
log = getPluginLogger(__name__)
log = logging.getLogger(__name__)
class GtkUI(GtkPluginBase):
def enable(self):

View File

@ -33,14 +33,14 @@
#
#
from deluge.log import getPluginLogger
import logging
from deluge.ui.client import client
from deluge import component
from deluge.plugins.pluginbase import WebPluginBase
from common import get_resource
log = getPluginLogger(__name__)
log = logging.getLogger(__name__)
class WebUI(WebPluginBase):

View File

@ -36,16 +36,16 @@
import os
import time
import hashlib
import logging
from subprocess import Popen, PIPE
from deluge.log import getPluginLogger
from deluge.plugins.pluginbase import CorePluginBase
import deluge.component as component
from deluge.configmanager import ConfigManager
from deluge.core.rpcserver import export
from deluge.event import DelugeEvent
log = getPluginLogger(__name__)
log = logging.getLogger(__name__)
DEFAULT_CONFIG = {
"commands": []

View File

@ -35,15 +35,15 @@
import os
import gtk
import logging
import pkg_resources
from deluge.log import getPluginLogger
from deluge.ui.client import client
from deluge.plugins.pluginbase import GtkPluginBase
import deluge.component as component
import deluge.common
log = getPluginLogger(__name__)
log = logging.getLogger(__name__)
EXECUTE_ID = 0
EXECUTE_EVENT = 1

View File

@ -34,14 +34,14 @@
#
from deluge.log import getPluginLogger
import logging
from deluge.ui.client import client
from deluge import component
from deluge.plugins.pluginbase import WebPluginBase
from common import get_resource
log = getPluginLogger(__name__)
log = logging.getLogger(__name__)
class WebUI(WebPluginBase):

View File

@ -38,16 +38,16 @@
#
import os
import logging
from twisted.internet.utils import getProcessValue
from deluge.log import getPluginLogger
from deluge.plugins.pluginbase import CorePluginBase
import deluge.component as component
import deluge.configmanager
from deluge.core.rpcserver import export
log = getPluginLogger(__name__)
log = logging.getLogger(__name__)
DEFAULT_PREFS = {
"extract_path": "",

View File

@ -38,8 +38,8 @@
#
import gtk
import logging
from deluge.log import getPluginLogger
from deluge.ui.client import client
from deluge.plugins.pluginbase import GtkPluginBase
import deluge.component as component
@ -47,7 +47,7 @@ import deluge.common
from common import get_resource
log = getPluginLogger(__name__)
log = logging.getLogger(__name__)
class GtkUI(GtkPluginBase):
def enable(self):

View File

@ -37,12 +37,12 @@
#
#
from deluge.log import getPluginLogger
import logging
from deluge.ui.client import client
from deluge import component
from deluge.plugins.pluginbase import WebPluginBase
log = getPluginLogger(__name__)
log = logging.getLogger(__name__)
class WebUI(WebPluginBase):
def enable(self):

View File

@ -37,18 +37,18 @@
# statement from all source files in the program, then also delete it here.
#
import logging
import feedparser # for parsing rss feeds
import threading # for threaded updates
import re # for regular expressions
from twisted.internet.task import LoopingCall
from deluge.log import getPluginLogger
from deluge.plugins.pluginbase import CorePluginBase
import deluge.component as component
import deluge.configmanager
from deluge.core.rpcserver import export
log = getPluginLogger(__name__)
log = logging.getLogger(__name__)
DEFAULT_PREFS = {
"feeds": {},

View File

@ -34,14 +34,14 @@
# but you are not obligated to do so. If you do not wish to do so, delete
# this exception statement from your version. If you delete this exception
import logging
import feedparser # for proccessing feed entries
import os
from deluge.log import getPluginLogger
from deluge.ui.client import sclient, aclient
from deluge.plugins.webuipluginbase import WebUIPluginBase
from deluge import component
log = getPluginLogger(__name__)
log = logging.getLogger(__name__)
api = component.get("WebPluginApi")
forms = api.forms

View File

@ -37,18 +37,17 @@
# statement from all source files in the program, then also delete it here.
#
import logging
import os, statvfs
from datetime import datetime, timedelta
from twisted.internet import task
from deluge.log import getPluginLogger
from deluge.plugins.pluginbase import CorePluginBase
from deluge.event import DelugeEvent
import deluge.component as component
import deluge.configmanager
from deluge.core.rpcserver import export
log = getPluginLogger(__name__)
log = logging.getLogger(__name__)
class LowDiskSpaceEvent(DelugeEvent):

View File

@ -38,8 +38,8 @@
#
import gtk
import logging
from deluge.log import getPluginLogger
from deluge.ui.client import client
from deluge.plugins.pluginbase import GtkPluginBase
import deluge.component as component
@ -47,7 +47,7 @@ import deluge.common
from common import get_resource
log = getPluginLogger(__name__)
log = logging.getLogger(__name__)
class GtkUI(GtkPluginBase):

View File

@ -37,14 +37,14 @@
# statement from all source files in the program, then also delete it here.
#
from deluge.log import getPluginLogger
import logging
from deluge.ui.client import client
from deluge import component
from deluge.plugins.pluginbase import WebPluginBase
from common import get_resource
log = getPluginLogger(__name__)
log = logging.getLogger(__name__)
class WebUI(WebPluginBase):

View File

@ -37,7 +37,7 @@ torrent-label core plugin.
adds a status field for tracker.
"""
from deluge.log import getPluginLogger
import logging
from deluge.plugins.pluginbase import CorePluginBase
from deluge.core.rpcserver import export
from deluge.configmanager import ConfigManager
@ -47,7 +47,7 @@ from urlparse import urlparse
import traceback
import re
log = getPluginLogger(__name__)
log = logging.getLogger(__name__)
RE_VALID = re.compile("[a-z0-9_\-\.]*\Z")

View File

@ -35,8 +35,8 @@
import os
import logging
import pkg_resources # access plugin egg
from deluge.log import getPluginLogger
from deluge import component # for systray
from deluge.plugins.pluginbase import GtkPluginBase
import gtk, gobject
@ -46,7 +46,7 @@ import sidebar_menu
import label_config
import submenu
log = getPluginLogger(__name__)
log = logging.getLogger(__name__)
NO_LABEL = "No Label"

View File

@ -36,13 +36,13 @@
import gtk
import gtk.glade
import os
import logging
import pkg_resources # access plugin egg
import deluge.component as component
import deluge.common
from deluge.log import getPluginLogger
from deluge.ui.client import client
log = getPluginLogger(__name__)
log = logging.getLogger(__name__)
class LabelConfig(object):

View File

@ -37,13 +37,13 @@
import gtk
import gtk.glade
import logging
import deluge.component as component
import deluge.common
from deluge.log import getPluginLogger
from deluge.ui.client import client
log = getPluginLogger(__name__)
log = logging.getLogger(__name__)
NO_LABEL = "No Label"

View File

@ -35,13 +35,13 @@
import os
import logging
import pkg_resources # access plugin egg
from deluge.log import getPluginLogger
from deluge import component # for systray
import gtk, gobject
from deluge.ui.client import client
log = getPluginLogger(__name__)
log = logging.getLogger(__name__)
NO_LABEL = "No Label"

View File

@ -38,14 +38,14 @@
#
import os
import logging
import pkg_resources
from deluge.common import fspeed
from deluge.log import getPluginLogger
from deluge.ui.client import client
from deluge.plugins.pluginbase import WebPluginBase
from deluge import component
log = getPluginLogger(__name__)
log = logging.getLogger(__name__)
def get_resource(filename):
return pkg_resources.resource_filename("deluge.plugins.label",

View File

@ -37,11 +37,11 @@
# statement from all source files in the program, then also delete it here.
#
import logging
from twisted.internet import defer
from deluge import component
from deluge.log import getPluginLogger
log = getPluginLogger(__name__)
log = logging.getLogger(__name__)
try:
from deluge.event import known_events

View File

@ -38,18 +38,18 @@
#
import smtplib
import logging
from email.utils import formatdate
from twisted.internet import defer, threads
from deluge import component
from deluge.event import known_events
from deluge.log import getPluginLogger
from deluge.plugins.pluginbase import CorePluginBase
import deluge.configmanager
from deluge.core.rpcserver import export
from common import CustomNotifications
log = getPluginLogger(__name__)
log = logging.getLogger(__name__)
DEFAULT_PREFS = {
"smtp_enabled": False,

View File

@ -37,11 +37,11 @@
# statement from all source files in the program, then also delete it here.
#
import logging
from os.path import basename
import gtk
from twisted.internet import defer
from deluge.log import getPluginLogger
from deluge.ui.client import client
from deluge.plugins.pluginbase import GtkPluginBase
import deluge.component as component
@ -51,7 +51,7 @@ import deluge.configmanager
# Relative imports
from common import get_resource, CustomNotifications
log = getPluginLogger(__name__)
log = logging.getLogger(__name__)
try:
import pygame

View File

@ -6,12 +6,12 @@
# License: BSD - Please view the LICENSE file for additional information.
# ==============================================================================
import logging
from twisted.internet import task
from deluge import component
from deluge.event import DelugeEvent
from deluge.log import getPluginLogger
log = getPluginLogger(__name__)
log = logging.getLogger(__name__)
class FooEvent(DelugeEvent):
"""foo Event"""

View File

@ -37,8 +37,8 @@
# statement from all source files in the program, then also delete it here.
#
import logging
from twisted.internet import defer
from deluge.log import getPluginLogger
from deluge.ui.client import client
from deluge import component
from deluge.plugins.pluginbase import WebPluginBase
@ -47,7 +47,7 @@ import deluge.configmanager
# Relative imports
from common import get_resource
log = getPluginLogger(__name__)
log = logging.getLogger(__name__)
DEFAULT_PREFS = {
# FLASH

View File

@ -37,8 +37,7 @@
#
import time
from deluge.log import getPluginLogger
import logging
from deluge.plugins.pluginbase import CorePluginBase
import deluge.component as component
import deluge.configmanager
@ -47,7 +46,7 @@ from deluge.event import DelugeEvent
from twisted.internet import reactor
log = getPluginLogger(__name__)
log = logging.getLogger(__name__)
DEFAULT_PREFS = {
"low_down": -1.0,

View File

@ -37,8 +37,7 @@
#
import gtk
from deluge.log import getPluginLogger
import logging
from deluge.ui.client import client
from deluge.plugins.pluginbase import GtkPluginBase
import deluge.component as component
@ -46,7 +45,7 @@ import deluge.common
from common import get_resource
log = getPluginLogger(__name__)
log = logging.getLogger(__name__)
DAYS = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]

View File

@ -36,14 +36,14 @@
# statement from all source files in the program, then also delete it here.
#
from deluge.log import getPluginLogger
import logging
from deluge.ui.client import client
from deluge import component
from deluge.plugins.pluginbase import WebPluginBase
from common import get_resource
log = getPluginLogger(__name__)
log = logging.getLogger(__name__)
class WebUI(WebPluginBase):

View File

@ -44,17 +44,17 @@
# but you are not obligated to do so. If you do not wish to do so, delete
# this exception statement from your version. If you delete this exception
import logging
from twisted.internet.task import LoopingCall
import time
import deluge
from deluge.log import getPluginLogger
from deluge.plugins.pluginbase import CorePluginBase
from deluge import component
from deluge import configmanager
from deluge.core.rpcserver import export
log = getPluginLogger(__name__)
log = logging.getLogger(__name__)
DEFAULT_PREFS = {
"test": "NiNiNi",

View File

@ -48,7 +48,7 @@ port of old plugin by markybob.
"""
import time
import cairo
from deluge.log import getPluginLogger
import logging
from deluge.ui.client import client
black = (0, 0, 0)
@ -60,13 +60,13 @@ green = (0, 1.0, 0)
blue = (0, 0, 1.0)
orange = (1.0, 0.74, 0)
log = getPluginLogger(__name__)
log = logging.getLogger(__name__)
def default_formatter(value):
return str(value)
def change_opacity(color, opactiy):
"""A method to assist in changing the opactiy of a color inorder to draw the
"""A method to assist in changing the opacity of a color in order to draw the
fills.
"""
color = list(color)

View File

@ -47,19 +47,19 @@
import gtk
import gobject
import logging
from gtk.glade import XML
from twisted.internet import defer
import graph
from deluge import component
from deluge.log import getPluginLogger
from deluge.common import fspeed
from deluge.ui.client import client
from deluge.ui.gtkui.torrentdetails import Tab
from deluge.plugins.pluginbase import GtkPluginBase
log = getPluginLogger(__name__)
log = logging.getLogger(__name__)
class GraphsTab(Tab):
def __init__(self, glade):

View File

@ -33,20 +33,20 @@
#
#
from deluge.log import getPluginLogger
import logging
from deluge.ui.client import client
from deluge import component
from deluge.plugins.pluginbase import WebPluginBase
from common import get_resource
log = getPluginLogger(__name__)
log = logging.getLogger(__name__)
class WebUI(WebPluginBase):
scripts = [get_resource("stats.js")]
# The enable and disable methods are not scrictly required on the WebUI
# The enable and disable methods are not strictly required on the WebUI
# plugins. They are only here if you need to register images/stylesheets
# with the webserver.
def enable(self):

View File

@ -37,13 +37,13 @@
# statement from all source files in the program, then also delete it here.
#
from deluge.log import getPluginLogger
import logging
from deluge.plugins.pluginbase import CorePluginBase
import deluge.component as component
import deluge.configmanager
from deluge.core.rpcserver import export
log = getPluginLogger(__name__)
log = logging.getLogger(__name__)
DEFAULT_PREFS = {
}

View File

@ -38,8 +38,8 @@
#
import gtk
import logging
from deluge.log import getPluginLogger
from deluge.ui.client import client
from deluge.plugins.pluginbase import GtkPluginBase
import deluge.component as component
@ -47,7 +47,7 @@ import deluge.common
from common import get_resource
log = getPluginLogger(__name__)
log = logging.getLogger(__name__)
class GtkUI(GtkPluginBase):
def enable(self):

View File

@ -37,14 +37,14 @@
# statement from all source files in the program, then also delete it here.
#
from deluge.log import getPluginLogger
import logging
from deluge.ui.client import client
from deluge import component
from deluge.plugins.pluginbase import WebPluginBase
from common import get_resource
log = getPluginLogger(__name__)
log = logging.getLogger(__name__)
class WebUI(WebPluginBase):

View File

@ -37,13 +37,13 @@
#
import os
import logging
from deluge import common, component, configmanager
from deluge.log import getPluginLogger
from deluge.plugins.pluginbase import CorePluginBase
from deluge.core.rpcserver import export
log = getPluginLogger(__name__)
log = logging.getLogger(__name__)
DEFAULT_PREFS = {
"enabled": False,

View File

@ -37,8 +37,8 @@
#
import gtk
import logging
from deluge.log import getPluginLogger
from deluge.ui.client import client
from deluge.plugins.pluginbase import GtkPluginBase
import deluge.component as component
@ -46,7 +46,7 @@ import deluge.common
from common import get_resource
log = getPluginLogger(__name__)
log = logging.getLogger(__name__)
class GtkUI(GtkPluginBase):
def enable(self):

View File

@ -113,6 +113,7 @@ def create_plugin():
CORE = """
import logging
from deluge.plugins.pluginbase import CorePluginBase
import deluge.component as component
import deluge.configmanager
@ -122,6 +123,8 @@ DEFAULT_PREFS = {
"test":"NiNiNi"
}
log = logging.getLogger(__name__)
class Core(CorePluginBase):
def enable(self):
self.config = deluge.configmanager.ConfigManager("%(safe_name)s.conf", DEFAULT_PREFS)
@ -216,8 +219,8 @@ def get_resource(filename):
GTKUI = """
import gtk
import logging
from deluge.log import getPluginLogger
from deluge.ui.client import client
from deluge.plugins.pluginbase import GtkPluginBase
import deluge.component as component
@ -225,7 +228,7 @@ import deluge.common
from common import get_resource
log = getPluginLogger(__name__)
log = logging.getLogger(__name__)
class GtkUI(GtkPluginBase):
def enable(self):
@ -285,14 +288,14 @@ GLADE = """<?xml version="1.0" encoding="UTF-8" standalone="no"?>
"""
WEBUI = """
from deluge.log import getPluginLogger
import logging
from deluge.ui.client import client
from deluge import component
from deluge.plugins.pluginbase import WebPluginBase
from common import get_resource
log = getPluginLogger(__name__)
log = logging.getLogger(__name__)
class WebUI(WebPluginBase):