1
0
Fork 0
forked from github/pelican

change the way logging is done, using the standard log tree instead of

calling the module-level functions on an unitialised logging object.

This allows to
- simplify log.py
- use one logger object for each file
This commit is contained in:
Andrea Crotti 2012-03-20 13:01:21 +00:00
commit 0922efa371
7 changed files with 79 additions and 65 deletions

View file

@ -1,15 +1,19 @@
# -*- coding: utf-8 -*-
import locale
import logging
import functools
from datetime import datetime
from os import getenv
from sys import platform, stdin
import functools
import locale
from pelican.log import warning, error
from pelican.settings import _DEFAULT_CONFIG
from pelican.utils import slugify, truncate_html_words
logger = logging.getLogger(__name__)
class Page(object):
"""Represents a page
Given a content, and metadata, create an adequate object.
@ -44,7 +48,7 @@ class Page(object):
else:
title = filename.decode('utf-8') if filename else self.title
self.author = Author(getenv('USER', 'John Doe'), settings)
warning(u"Author of `{0}' unknown, assuming that his name is "
logger.warning(u"Author of `{0}' unknown, assuming that his name is "
"`{1}'".format(title, self.author))
# manage languages
@ -200,6 +204,6 @@ def is_valid_content(content, f):
content.check_properties()
return True
except NameError, e:
error(u"Skipping %s: impossible to find informations about '%s'"\
logger.error(u"Skipping %s: impossible to find informations about '%s'"\
% (f, e))
return False