Static site generator that supports Markdown and reST syntax. Powered by Python.
  • Python 85.3%
  • CSS 8.7%
  • Jinja 6%
Find a file
Ryan de Kleer b662bdbc50 Rework log (setup and filtering) implementation
Overview
========
Motivated by issue #3037 (Ensure proper log line/filename in
warning/errors).

``pelican.log`` is no longer required to be early in the import order,
as the package no longer relies on a custom logging class.

Logging setup is now uncoupled so that format and filters can be applied
independently, which makes both setup and testing more flexible.

Behavior of commandline calls have not changed, except for some
modification to help texts.

``LOG_FATAL`` and ``LOG_ONCE_LEVEL`` are new configuration keys.

Summary of changes
==================

:pelican/__init__.py:

    * Parsing commandline:
        * Unify type-converstion from string to logging levels.
        * Tweak some help text in ``parse_arguments``.
    * Preserve ``log`` namespace throughout (for clarity).
    * FIX: ``pelican.listen`` verbosity: avoid assumption that the
      logger's level will be NOTSET.

:pelican/log.py:

    * FIX (#3037): warnings & errors now display the correct line numbers.
    * Split logging filters with focus on a specific aspect of behavior.
      This allows for more
        a) independence in testing and
        b) powerful logger configuration, with fewer side effects.
    * Isolate configuration *reading* from configuration *application*
      (see ``pelican/settings.py``).

:pelican/settings.py:

    * Remove ``pelican.log`` dependency.
    * Isolate configuration *reading* from configuration *application*;
      to remove dependency on a global state when modifying log filters.
    * Add validation for LOG_LIMIT values.

:pelican/tests/__init__.py:

    * Remove dependency on ``pelican.log`` module as test runners setup
      their own console handler anyway.
    * Only add ``NullHandler`` in absence of a configured logger.

:pelican/tests/support.py:

    * Remove ``LoggedTestCase`` class; tests requiring logging analysis
      use a contextmanager (``LogCountHandler.examine``) instead.

:pelican/tests/test_log.py:

    * Rewrite to reflect changes in pelican's logging module.
    * Increase code coverage.

:pelican/tests/test_contents.py:
:pelican/tests/test_pelican.py:
:pelican/tests/test_utils.py:

    * Import ``unittest`` directly, rather than from other modules.
    * Switch to using contextmanager (``LogCountHandler.examine``) for
      test-specific log inspection.
    * Remove dependency on a custom TestCase (used in logging analysis).
    * Remove code involved with temporarily disabling log filters --
      the filters in question are now only enabled in tests directly
      testing them (eg. in ``test_log.py``)

:pelican/tests/test_settings.py:

    * Add test for LOG_FILTER values from configs.
2023-10-29 15:11:46 -07:00
.github Merge pull request #3189 from seanh/publish-to-ghp-using-gha 2023-10-29 18:29:52 +01:00
docs Merge pull request #3189 from seanh/publish-to-ghp-using-gha 2023-10-29 18:29:52 +01:00
pelican Rework log (setup and filtering) implementation 2023-10-29 15:11:46 -07:00
requirements migrate configuration to PEP621 compatible config 2023-10-29 11:59:58 +01:00
samples Modernize code base to Python 3+ syntax 2020-04-27 09:45:31 +02:00
.coveragerc [coveralls] Exclude tests from coverage 2014-06-24 22:29:36 +01:00
.editorconfig Add .yaml file extension to EditorConfig 2021-02-18 15:06:29 +01:00
.gitattributes Tell GitHub-Linguist to ignore HTML files 2023-08-27 16:47:45 +02:00
.gitignore migrate configuration to PEP621 compatible config 2023-10-29 11:59:58 +01:00
.mailmap .mailmap: Add mappings to consolidate author names and emails 2013-04-12 10:51:48 -04:00
.pre-commit-config.yaml Use ruff in pre-commit 2023-10-28 10:44:47 -07:00
.readthedocs.yaml Build docs in zipped HTML and PDF formats 2023-08-03 14:44:13 +02:00
CONTRIBUTING.rst Remove useless url 2023-08-03 08:49:16 +02:00
LICENSE Update links to HTTPS and current 301 redirects in docs/templates/themes (#2661) 2020-04-12 16:38:35 +02:00
pyproject.toml Include more files in PDM sdist builds 2023-10-29 16:12:09 +01:00
README.rst Add monthly downloads badge to README 2023-08-02 11:01:40 +02:00
tasks.py migrate configuration to PEP621 compatible config 2023-10-29 11:59:58 +01:00
THANKS Add more contributors to THANKS 2021-10-12 15:58:53 +02:00
tox.ini Use poetry directly in lints 2023-10-28 11:05:15 -07:00

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Pelican |build-status| |pypi-version| |downloads| |repology|
============================================================

Pelican is a static site generator, written in Python_, that allows you to create
web sites by composing text files in formats such as Markdown, reStructuredText, and HTML.

With Pelican, you can create web sites without worrying about databases or server-side programming.
Pelican generates static sites that can be served via any web server or hosting service.

You can perform the following functions with Pelican:

* Compose content in Markdown_ or reStructuredText_ using your editor of choice
* Simple command-line tool (re)generates HTML, CSS, and JS from your source content
* Easy to interface with version control systems and web hooks
* Completely static output is simple to host anywhere


Features
--------

Pelicans feature highlights include:

* Chronological content (e.g., articles, blog posts) as well as static pages
* Integration with external services
* Site themes (created using Jinja2_ templates)
* Publication of articles in multiple languages
* Generation of Atom and RSS feeds
* Code syntax highlighting via Pygments_
* Import existing content from WordPress, Dotclear, or RSS feeds
* Fast rebuild times due to content caching and selective output writing
* Extensible via a rich plugin ecosystem: `Pelican Plugins`_

Check out the `Pelican documentation`_ for further information.


How to get help, contribute, or provide feedback
------------------------------------------------

See our `contribution submission and feedback guidelines <CONTRIBUTING.rst>`_.


Source code
-----------

Pelicans source code is `hosted on GitHub`_. For information on how it works,
have a look at `Pelican's internals`_.


Why the name “Pelican”?
-----------------------

“Pelican” is an anagram of *calepin*, which means “notebook” in French.


.. Links

.. _Python: https://www.python.org/
.. _reStructuredText: http://docutils.sourceforge.net/rst.html
.. _Markdown: https://daringfireball.net/projects/markdown/
.. _Jinja2: https://palletsprojects.com/p/jinja/
.. _Pygments: https://pygments.org/
.. _`Pelican Plugins`: https://github.com/pelican-plugins
.. _`Pelican documentation`: https://docs.getpelican.com/
.. _`Pelican's internals`: https://docs.getpelican.com/en/latest/internals.html
.. _`hosted on GitHub`: https://github.com/getpelican/pelican

.. |build-status| image:: https://img.shields.io/github/actions/workflow/status/getpelican/pelican/main.yml?branch=master
   :target: https://github.com/getpelican/pelican/actions/workflows/main.yml?query=branch%3Amaster
   :alt: GitHub Actions CI: continuous integration status
.. |pypi-version| image:: https://img.shields.io/pypi/v/pelican.svg
   :target: https://pypi.org/project/pelican/
   :alt: PyPI: the Python Package Index
.. |downloads| image:: https://img.shields.io/pypi/dm/pelican.svg
   :target: https://pypi.org/project/pelican/
   :alt: Monthly Downloads from PyPI
.. |repology| image:: https://repology.org/badge/tiny-repos/pelican.svg
   :target: https://repology.org/project/pelican/versions
   :alt: Repology: the packaging hub