mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Calls to «print» replaced by the «pelican.log» module.
This commit is contained in:
parent
834c952f20
commit
3166e6dfe3
6 changed files with 33 additions and 13 deletions
|
|
@ -7,6 +7,7 @@ from pelican.generators import (ArticlesGenerator, PagesGenerator,
|
|||
from pelican.settings import read_settings
|
||||
from pelican.utils import clean_output_dir, files_changed
|
||||
from pelican.writers import Writer
|
||||
from pelican import log
|
||||
|
||||
VERSION = "2.6.0"
|
||||
|
||||
|
|
@ -103,6 +104,12 @@ def main():
|
|||
action='store_true',
|
||||
help='Keep the output directory and just update all the generated files.'
|
||||
'Default is to delete the output directory.')
|
||||
parser.add_argument('-v', '--verbose', action='store_const', const=log.INFO, dest='verbosity',
|
||||
help='Show all messages')
|
||||
parser.add_argument('-q', '--quiet', action='store_const', const=log.CRITICAL, dest='verbosity',
|
||||
help='Show only critical errors')
|
||||
parser.add_argument('-D', '--debug', action='store_const', const=log.DEBUG, dest='verbosity',
|
||||
help='Show all message, including debug messages')
|
||||
parser.add_argument('--version', action='version', version=VERSION,
|
||||
help='Print the pelican version and exit')
|
||||
parser.add_argument('-r', '--autoreload', dest='autoreload', action='store_true',
|
||||
|
|
@ -110,6 +117,7 @@ def main():
|
|||
"files")
|
||||
args = parser.parse_args()
|
||||
|
||||
log.init(args.verbosity)
|
||||
# Split the markup languages only if some have been given. Otherwise, populate
|
||||
# the variable with None.
|
||||
markup = [a.strip().lower() for a in args.markup.split(',')] if args.markup else None
|
||||
|
|
@ -134,7 +142,10 @@ def main():
|
|||
except KeyboardInterrupt:
|
||||
break
|
||||
else:
|
||||
pelican.run()
|
||||
try:
|
||||
pelican.run()
|
||||
except Exception, e:
|
||||
log.critical(str(e))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue