Skip to content

Commit

Permalink
Re-ordered the logging to use the module namespace to segregate itself
Browse files Browse the repository at this point in the history
Added a TODO to a hanging comment
  • Loading branch information
slick666 committed Apr 18, 2016
1 parent d773252 commit 21ecda7
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 61 deletions.
3 changes: 1 addition & 2 deletions ircb/bouncer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
import asyncio
import logging

Expand All @@ -12,7 +11,7 @@
from ircb.storeclient import initialize as storeclient_initialize
from ircb.storeclient import ChannelStore, ClientStore, NetworkStore, UserStore

logger = logging.getLogger('bouncer')
logger = logging.getLogger(__name__)


class BouncerServerClientProtocol(Connection):
Expand Down
81 changes: 27 additions & 54 deletions ircb/config/default_settings.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import yaml

SECRET_KEY = 'some key'

DB_URI = 'sqlite:///ircb.db'
Expand All @@ -6,60 +8,31 @@
'stores': 'tcp://127.0.0.1:35000',
}

LOGGING_CONF = dict(
version=1,
formatters=dict(
bare={
"datefmt": "%Y-%m-%d %H:%M:%S",
"format": "[%(asctime)s][%(name)10s %(levelname)7s] %(message)s"
},
),
handlers=dict(
console={
"class": "logging.StreamHandler",
"formatter": "bare",
"level": "DEBUG",
"stream": "ext://sys.stdout",
}
),
loggers=dict(
ircb={
"level": "DEBUG",
"propagate": False,
"handlers": ["console"],
},
network={
"level": "DEBUG",
"propagate": False,
"handlers": ["console"],
},
bouncer={
"level": "DEBUG",
"propagate": False,
"handlers": ["console"],
},
stores={
"level": "DEBUG",
"propagate": False,
"handlers": ["console"],
},
dispatcher={
"level": "DEBUG",
"propagate": False,
"handlers": ["console"],
},
irc={
"level": "DEBUG",
"propagate": False,
"handlers": ["console"],
},
aiohttp={
"level": "DEBUG",
"propagate": False,
"handlers": ["console"],
}
),
)
LOGGING_CONF = yaml.load("""
version: 1
formatters:
simple:
datefmt: '%Y-%m-%d %H:%M:%S',
format: '[%(asctime)s][%(name)10s %(levelname)7s] %(message)s'
handlers:
console:
class: logging.StreamHandler
level: DEBUG
formatter: simple
stream: ext://sys.stdout
loggers:
simpleExample:
level: DEBUG
handlers: [console]
propagate: no
root:
level: DEBUG
handlers: [console]
""")

INTERNAL_HOST = '127.0.0.1'
REDIS_HOST = '127.0.0.1'
Expand Down
2 changes: 1 addition & 1 deletion ircb/irc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from ircb.storeclient import NetworkStore
from ircb.storeclient import ChannelStore

logger = logging.getLogger('irc')
logger = logging.getLogger(__name__)


class IrcbIrcConnection(irc3.IrcConnection):
Expand Down
2 changes: 1 addition & 1 deletion ircb/irc/plugins/autojoins.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ def __init__(self, bot):

@irc3.event(irc3.rfc.KICK)
def on_kick(self, mask, channel, target, **kwargs):
# noop for now
# noop for now TODO: Address this later
pass
2 changes: 1 addition & 1 deletion ircb/lib/dispatcher/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from ircb.config import settings

logger = logging.getLogger('dispatcher')
logger = logging.getLogger(__name__)


class Handler(aiozmq.rpc.AttrHandler):
Expand Down
2 changes: 1 addition & 1 deletion ircb/stores/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from ircb.lib.dispatcher import Dispatcher
from ircb.models.lib import Base

logger = logging.getLogger('stores')
logger = logging.getLogger(__name__)


class BaseStore(object):
Expand Down
2 changes: 1 addition & 1 deletion ircb/web/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from ircb.web.network import NetworkConnectionView
from ircb.utils.config import load_config

logger = logging.getLogger('aiohttp.access')
logger = logging.getLogger(__name__)


@asyncio.coroutine
Expand Down

0 comments on commit 21ecda7

Please sign in to comment.