1
0
Fork 0
forked from github/pelican
Commit graph

48 commits

Author SHA1 Message Date
MinchinWeb
a52922bfb5 Move rich's console to log.py 2021-07-08 21:33:22 -06:00
MinchinWeb
80f44c494a Switch to rich logging 2021-06-30 22:47:32 -06:00
Kernc
cd3048d4cf
Force root logger to be of FatalLogger class
This enforces FatalLogger policy upon pelican plugins
that might contain codes such as:

    import logging
    log = logging.getLogger()

    log.warning(...)
    # or
    logging.warning(...)
2020-06-05 01:50:00 +02:00
Deniz Turgut
50281c42e5
Fix dictionary logging in formatter
Python special cases single Mapping arguments to logging. This
adjusts BaseFormatter to skip "fancy" formatting if argument
is of type Mapping. Also adds various formatted log outputs.
2020-05-09 21:25:38 +03:00
Justin Mayer
d43b786b30 Modernize code base to Python 3+ syntax
Replaces syntax that was relevant in earlier Python versions but that
now has modernized equivalents.
2020-04-27 09:45:31 +02:00
Deniz Turgut
97dbafcb89 Fix LOG_FILTER to act on exact messages
* Adds the ability to filter templated messages by exact message,
as well as templates.
* Adds a test for LimitFilter.

Fixes #2552,  #2682
2020-04-12 21:00:27 +03:00
Deniz Turgut
16968834ce Convert super() calls to py3 style 2019-11-26 06:17:04 +09:00
Kevin Yap
1e0e541b57 Initial pass of removing Python 2 support
This commit removes Six as a dependency for Pelican, replacing the
relevant aliases with the proper Python 3 imports. It also removes
references to Python 2 logic that did not require Six.
2019-11-26 06:16:41 +09:00
Oliver Urs Lenz
9ae32b8ff9 Try importing from collections.abc for compatibility with Python 3.8 2018-11-24 21:59:40 +01:00
Deniz Turgut
dd76c7158f Improve the looks of reST parser error output. 2018-11-10 23:08:10 +01:00
Lucas Cimon
f5cc21df0e
Adding --logs-deduping-min-level CLI option 2017-12-15 14:59:47 +01:00
derwinlu
5a19887a22 Correct new flake8 warnings 2017-01-24 09:12:16 +01:00
Deniz Turgut
a8be1b562e Fixes Exception name related bugs
Fixes two bugs that was introduced by #1743:

 - First was the unnecessary exception name output when skipping
content files if a required metadata wasn't available.
It was
`ERROR: Skipping ./demo.rst: could not find information about 'NameError: date'`
and now should be
`ERROR: Skipping ./demo.rst: could not find information about 'date'`

 - Second was a more serious issue. Improper string formatting in the logger
resulted in implicit decoding and would break for non-ascii error messages.
2016-10-29 14:10:54 -04:00
Alexander Turenko
30b8955134 Don't suppress LOG_FILTER messages when --debug passed 2016-09-23 02:13:23 +03:00
Alexander Turenko
1b1d1fd9f7 Allow to filter out log messages by templates
Fixes #1594.
2016-09-23 02:13:23 +03:00
Kernc
9a04ce660c Add --fatal=errors|warnings program option 2016-01-09 02:42:02 +01:00
Justin Mayer
880ba20a98 Merge pull request #1850 from ingwinlu/deprecation_warnings
Make Pelican Python 3.5 compatible
2015-11-03 07:22:12 -08:00
derwinlu
ab2eec854d Redo ANSI support detection
When using nose to directly run the test suite it 'steals' stdout per
default. This causes the old implementation of ANSI detection to error
as stdout does not have a fileno function anymore.
2015-10-22 09:45:54 +02:00
derwinlu
e50abb20b3 Add logging for warnings during test suite run
The default configuration for the warnings module changed some time ago
so we lost the ability to detect deprecation warnings and such early.

This commit sets up the test suite to redirect all warnings through our
logging system. Additionally we enable DeprecationWarnings as a default
and throw exceptions on all warnings related to pelican modules.

This enables output of warnings related to dependencies, while letting
tests only fail if the warnings are originating from pelican's source.

Also adding a test to detect if warnings cause an Exception as expected.
2015-10-22 09:45:04 +02:00
derwinlu
a69f4294bc Add ability to toggle log filter
To test the output of warning functions it can be useful to disable the
log filter, producing the expected output instead of the limited output
that is used during normal operation.
2015-10-19 16:28:47 +02:00
derwinlu
8993c55e6e fulfil pep8 standard 2015-08-17 13:34:32 +02:00
Deniz Turgut
735a4452df Fix exception logging
Adds exception type to the exception logging.
Removes the extra logging for autoreload in debug mode, since `raise`
will make it caught by the global `try/except` below and it'll be
logged there.

This replaces #1723 and also removes extra exception logging caused
in #1718.
2015-06-03 17:07:38 -04:00
Carlos E. Garcia
f5775bcba0 minor spelling fixes 2014-09-15 20:29:00 -04:00
Deniz Turgut
ed3209888a Refactor logging handling
Old system was using manual string formatting for log messages.
This caused issues with common operations like exception logging
because often they need to be handled differently for Py2/Py3
compatibility. In order to unify the effort:

 - All logging is changed to `logging.level(msg, arg1, arg2)` style.
 - A `SafeLogger` is implemented to auto-decode exceptions properly
in the args (ref #1403).
 - Custom formatters were overriding useful logging functionality
like traceback outputing (ref #1402). They are refactored to be
more transparent. Traceback information is provided in `--debug`
mode for `read_file` errors in generators.
 - Formatters will now auto-format multiline log messages in order
to make them look related. Similarly, traceback will be formatted in
the same fashion.
 - `pelican.log.LimitFilter` was (ab)using logging message which
would result in awkward syntax for argumented logging style. This
functionality is moved to `extra` keyword argument.
 - Levels for errors that would result skipping a file (`read_file`)
changed from `warning` to `error` in order to make them stand out
among other logs.
 - Small consistency changes to log messages (i.e. changing all
to start with an uppercase letter) and quality-of-life improvements
(some log messages were dumping raw object information).
2014-07-22 12:39:39 -04:00
Justin Mayer
7e06912bca Minor text changes to log message limitation 2014-04-14 16:18:07 -04:00
Rogdham
d9b0091357 Limit and filter logs
Drop duplicates logs.
Allow for logs to be grouped, enforcing a maximum number of logs per group.
Add the LOG_FILTER setting to ask from the configuration file to ignore some
logs (of level up to warning).
2014-04-01 20:44:09 +02:00
Deniz Turgut
0548b62441 fix for issue #761: handle unicode correctly in summary for Markdown 2013-04-03 19:38:42 -04:00
Alexis Métaireau
519dcdbcb3 Manual pass on sources for better standards. 2013-03-03 20:12:31 -08:00
Dirk Makowski
71995d5e1b Port pelican to python 3.
Stays compatible with 2.x series, thanks to an unified codebase.
2013-01-11 03:20:09 +01:00
m-r-r
5aa12b2319 pelican/log.py simplified a bit 2012-03-25 18:47:14 +02:00
Andrea Crotti
0922efa371 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
2012-03-20 13:01:21 +00:00
Andrea Crotti
173133dbf3 remove couple of extra spaces 2012-03-16 14:53:28 +00:00
Andrea Crotti
26078ecc17 remove unused colors and refactor more how the escaping is done 2012-03-16 14:50:26 +00:00
Andrea Crotti
2ff3db8f51 fix the reset term code to make it work also on OSX 2012-03-15 19:37:49 +00:00
Andrea Crotti
20af8fd378 refactoring of the ANSI dictionary, removing all the repeated code 2012-03-07 12:17:39 +00:00
Andrea Crotti
4eb20c5d82 global declaration is only needed if it's necessary to modify a module
level variable, to declare it and use it read only it's not necessary
2012-03-07 12:00:32 +00:00
Stéphane Raimbault
9cced6be83 Sort imports and remove trailing whitespaces 2012-02-28 17:40:13 +01:00
Skami18
3bdb1eae0b Pelican no more use ANSI codes on Windows (CMD.exe don't support it) 2011-10-14 17:21:03 +02:00
Alexis Metaireau
b7daed2ce3 Merge branch 'hacks' of https://github.com/RonnyPfannschmidt/pelican 2011-05-07 19:12:30 +01:00
Skami18
252ba7d53a pelican.log.warning added to pelican.log.__all__ 2011-05-07 18:53:10 +02:00
Ronny Pfannschmidt
0441127c41 logging star import cleanups 2011-05-06 19:23:37 +02:00
Skami18
8732569a01 Removed a bug (debug messages was not showed) and improved readability 2011-04-25 12:13:44 +02:00
Alexis Metaireau
698686e1d4 Catch all exceptions in __init__ 2011-04-20 14:44:25 +02:00
Skami18
af1bc749e1 Removed a bug related to unicode 2011-04-19 15:08:04 +02:00
Skami18
3166e6dfe3 Calls to «print» replaced by the «pelican.log» module. 2011-04-19 14:49:46 +02:00
Skami18
834c952f20 Added shortcuts functions in the `log' module 2011-04-19 11:49:24 +02:00
Skami18
c5578e338d Added a colored logging system 2011-04-18 20:14:07 +02:00
Skami18
9d10e2bff1 Added a logging system (will be useful for plugins) 2011-04-18 17:58:48 +02:00