Skip to content
Permalink
Browse files
Remove all leftover loghandlers support
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Jun 16, 2017
1 parent 4f2574c commit 330b5e4c59d8bff2249bc1179bf6dce9e2d48635
@@ -616,7 +616,6 @@ def __init__(self, **config):
'DEPLOY_FUTURE': False,
'SCHEDULE_ALL': False,
'SCHEDULE_RULE': '',
'LOGGING_HANDLERS': {'stderr': {'loglevel': 'WARNING', 'bubble': True}},
'DEMOTE_HEADERS': 1,
'GITHUB_SOURCE_BRANCH': 'master',
'GITHUB_DEPLOY_BRANCH': 'gh-pages',
@@ -61,7 +61,7 @@
PatternMatchingEventHandler = object

from nikola.plugin_categories import Command
from nikola.utils import dns_sd, req_missing, get_logger, get_theme_path, STDERR_HANDLER
from nikola.utils import dns_sd, req_missing, get_logger, get_theme_path
LRJS_PATH = os.path.join(os.path.dirname(__file__), 'livereload.js')
error_signal = signal('error')
refresh_signal = signal('refresh')
@@ -129,7 +129,7 @@ class CommandAuto(Command):

def _execute(self, options, args):
"""Start the watcher."""
self.logger = get_logger('auto', STDERR_HANDLER)
self.logger = get_logger('auto')
LRSocket.logger = self.logger

if WebSocket is object and watchdog is None:
@@ -32,7 +32,7 @@
from nikola.plugin_categories import Command
from nikola import utils

LOGGER = utils.get_logger('bootswatch_theme', utils.STDERR_HANDLER)
LOGGER = utils.get_logger('bootswatch_theme')


def _check_for_theme(theme, themes):
@@ -43,7 +43,7 @@
import requests

from nikola.plugin_categories import Command
from nikola.utils import get_logger, STDERR_HANDLER
from nikola.utils import get_logger


def _call_nikola_list(site, cache=None):
@@ -158,7 +158,7 @@ class CommandCheck(Command):

def _execute(self, options, args):
"""Check the generated site."""
self.logger = get_logger('check', STDERR_HANDLER)
self.logger = get_logger('check')

if not options['links'] and not options['files'] and not options['clean']:
print(self.help())
@@ -31,9 +31,9 @@

from nikola import __version__
from nikola.plugin_categories import Command
from nikola.utils import get_logger, STDERR_HANDLER, req_missing, Commands
from nikola.utils import get_logger, req_missing, Commands

LOGGER = get_logger('console', STDERR_HANDLER)
LOGGER = get_logger('console')


class CommandConsole(Command):
@@ -37,7 +37,7 @@
from blinker import signal

from nikola.plugin_categories import Command
from nikola.utils import get_logger, clean_before_deployment, STDERR_HANDLER
from nikola.utils import get_logger, clean_before_deployment


class CommandDeploy(Command):
@@ -52,7 +52,7 @@ class CommandDeploy(Command):

def _execute(self, command, args):
"""Execute the deploy command."""
self.logger = get_logger('deploy', STDERR_HANDLER)
self.logger = get_logger('deploy')
# Get last successful deploy date
timestamp_path = os.path.join(self.site.config['CACHE_FOLDER'], 'lastdeploy')

@@ -32,7 +32,7 @@

from nikola.plugin_categories import Command
from nikola.plugins.command.check import real_scan_files
from nikola.utils import get_logger, req_missing, clean_before_deployment, STDERR_HANDLER
from nikola.utils import get_logger, req_missing, clean_before_deployment
from nikola.__main__ import main
from nikola import __version__

@@ -82,7 +82,7 @@ class CommandGitHubDeploy(Command):

def _execute(self, options, args):
"""Run the deployment."""
self.logger = get_logger(CommandGitHubDeploy.name, STDERR_HANDLER)
self.logger = get_logger(CommandGitHubDeploy.name)

# Check if ghp-import is installed
check_ghp_import_installed()
@@ -58,7 +58,7 @@
from nikola.plugins.basic_import import ImportMixin, links
from nikola.plugins.command.init import SAMPLE_CONF, prepare_config, format_default_translations_config

LOGGER = utils.get_logger('import_wordpress', utils.STDERR_HANDLER)
LOGGER = utils.get_logger('import_wordpress')


def install_plugin(site, plugin_name, output_dir=None, show_install_notes=False):
@@ -42,11 +42,11 @@
import nikola
from nikola.nikola import DEFAULT_INDEX_READ_MORE_LINK, DEFAULT_FEED_READ_MORE_LINK, LEGAL_VALUES, urlsplit, urlunsplit
from nikola.plugin_categories import Command
from nikola.utils import ask, ask_yesno, get_logger, makedirs, STDERR_HANDLER, load_messages
from nikola.utils import ask, ask_yesno, get_logger, makedirs, load_messages
from nikola.packages.tzlocal import get_localzone


LOGGER = get_logger('init', STDERR_HANDLER)
LOGGER = get_logger('init')

SAMPLE_CONF = {
'BLOG_AUTHOR': "Your Name",
@@ -41,8 +41,8 @@
from nikola import utils

COMPILERS_DOC_LINK = 'https://getnikola.com/handbook.html#configuring-other-input-formats'
POSTLOGGER = utils.get_logger('new_post', utils.STDERR_HANDLER)
PAGELOGGER = utils.get_logger('new_page', utils.STDERR_HANDLER)
POSTLOGGER = utils.get_logger('new_post')
PAGELOGGER = utils.get_logger('new_page')
LOGGER = POSTLOGGER


@@ -41,7 +41,7 @@
from nikola.plugin_categories import Command
from nikola import utils

LOGGER = utils.get_logger('plugin', utils.STDERR_HANDLER)
LOGGER = utils.get_logger('plugin')


class CommandPlugin(Command):
@@ -46,7 +46,7 @@


from nikola.plugin_categories import Command
from nikola.utils import dns_sd, get_logger, STDERR_HANDLER
from nikola.utils import dns_sd, get_logger


class IPv6Server(HTTPServer):
@@ -120,7 +120,7 @@ def shutdown(self, signum=None, _frame=None):

def _execute(self, options, args):
"""Start test server."""
self.logger = get_logger('serve', STDERR_HANDLER)
self.logger = get_logger('serve')
out_dir = self.site.config['OUTPUT_FOLDER']
if not os.path.isdir(out_dir):
self.logger.error("Missing '{0}' folder?".format(out_dir))
@@ -41,7 +41,7 @@
from nikola.plugin_categories import Command
from nikola import utils

LOGGER = utils.get_logger('theme', utils.STDERR_HANDLER)
LOGGER = utils.get_logger('theme')


class CommandTheme(Command):
@@ -42,7 +42,7 @@

from nikola import shortcodes as sc
from nikola.plugin_categories import PageCompiler
from nikola.utils import makedirs, req_missing, get_logger, STDERR_HANDLER, LocaleBorg
from nikola.utils import makedirs, req_missing, get_logger, LocaleBorg


class CompileIPynb(PageCompiler):
@@ -55,7 +55,7 @@ class CompileIPynb(PageCompiler):

def set_site(self, site):
"""Set Nikola site."""
self.logger = get_logger('compile_ipynb', STDERR_HANDLER)
self.logger = get_logger('compile_ipynb')
super(CompileIPynb, self).set_site(site)

def _compile_string(self, nb_json):
@@ -87,11 +87,11 @@
Extension = Pattern = object

from nikola.plugin_categories import MarkdownExtension
from nikola.utils import get_logger, STDERR_HANDLER
from nikola.utils import get_logger

import requests

LOGGER = get_logger('compile_markdown.mdx_gist', STDERR_HANDLER)
LOGGER = get_logger('compile_markdown.mdx_gist')

GIST_JS_URL = "https://gist.github.com/{0}.js"
GIST_FILE_JS_URL = "https://gist.github.com/{0}.js?file={1}"
@@ -46,7 +46,6 @@
get_logger,
makedirs,
write_metadata,
STDERR_HANDLER,
LocaleBorg,
map_metadata
)
@@ -186,7 +185,7 @@ def set_site(self, site):
self.config_dependencies.append(plugin_info.name)
plugin_info.plugin_object.short_help = plugin_info.description

self.logger = get_logger('compile_rest', STDERR_HANDLER)
self.logger = get_logger('compile_rest')
if not site.debug:
self.logger.level = 4

@@ -34,7 +34,7 @@
from nikola import utils
from nikola.post import Post

LOGGER = utils.get_logger('scan_posts', utils.STDERR_HANDLER)
LOGGER = utils.get_logger('scan_posts')


class ScanPosts(PostScanner):
@@ -12,7 +12,7 @@

TABLE = {}

LOGGER = utils.get_logger('scan_posts', utils.STDERR_HANDLER)
LOGGER = utils.get_logger('scan_posts')


def _populate():
@@ -45,7 +45,7 @@ class BuildBundles(LateTask):

def set_site(self, site):
"""Set Nikola site."""
self.logger = utils.get_logger('bundles', utils.STDERR_HANDLER)
self.logger = utils.get_logger('bundles')
if webassets is None and site.config['USE_BUNDLES']:
utils.req_missing(['webassets'], 'USE_BUNDLES', optional=True)
self.logger.warn('Setting USE_BUNDLES to False.')
@@ -66,7 +66,7 @@ def set_site(self, site):
site.register_path_handler('gallery_global', self.gallery_global_path)
site.register_path_handler('gallery_rss', self.gallery_rss_path)

self.logger = utils.get_logger('render_galleries', utils.STDERR_HANDLER)
self.logger = utils.get_logger('render_galleries')

self.kw = {
'thumbnail_size': site.config['THUMBNAIL_SIZE'],
@@ -40,7 +40,7 @@ class ScaleImage(Task, ImageProcessor):

def set_site(self, site):
"""Set Nikola site."""
self.logger = utils.get_logger('scale_images', utils.STDERR_HANDLER)
self.logger = utils.get_logger('scale_images')
return super(ScaleImage, self).set_site(site)

def process_tree(self, src, dst):
@@ -36,9 +36,9 @@
from markupsafe import Markup # It's ok, Mako requires it

from nikola.plugin_categories import TemplateSystem
from nikola.utils import makedirs, get_logger, STDERR_HANDLER
from nikola.utils import makedirs, get_logger

LOGGER = get_logger('mako', STDERR_HANDLER)
LOGGER = get_logger('mako')


class MakoTemplates(TemplateSystem):
@@ -129,14 +129,10 @@ def should_colorize(self, record):
return self._colorful


def get_logger(name, handlers):
def get_logger(name, handlers=None):
"""Get a logger with handlers attached."""
l = logbook.Logger(name)
for h in handlers:
if isinstance(h, list):
l.handlers += h
else:
l.handlers.append(h)
l.handlers += STDERR_HANDLER
return l


@@ -146,7 +142,7 @@ def get_logger(name, handlers):
)]


LOGGER = get_logger('Nikola', STDERR_HANDLER)
LOGGER = get_logger('Nikola')
STRICT_HANDLER = ExceptionHandler(ApplicationWarning, level='WARNING')

USE_SLUGIFY = True
@@ -165,7 +161,7 @@ def showwarning(message, category, filename, lineno, file=None, line=None):
n = category.__name__
except AttributeError:
n = str(category)
get_logger(n, STDERR_HANDLER).warn('{0}:{1}: {2}'.format(filename, lineno, message))
get_logger(n).warn('{0}:{1}: {2}'.format(filename, lineno, message))


warnings.showwarning = showwarning
@@ -719,21 +719,6 @@
# (defaults to 1.)
# DEMOTE_HEADERS = 1

# You can configure the logging handlers installed as plugins or change the
# log level of the default stdout handler.
LOGGING_HANDLERS = {
'stderr': {'loglevel': 'WARNING', 'bubble': True},
# 'smtp': {
# 'from_addr': 'test-errors@example.com',
# 'recipients': ('test@example.com'),
# 'credentials':('testusername', 'password'),
# 'server_addr': ('127.0.0.1', 25),
# 'secure': (),
# 'level': 'DEBUG',
# 'bubble': True
# }
}

# Templates will use those filters, along with the defaults.
# Consult your engine's documentation on filters if you need help defining
# those.

0 comments on commit 330b5e4

Please sign in to comment.