Commit Graph

61 Commits

Author SHA1 Message Date
Eric Traut
20b3b54460 Changed parameter name of several methods in logging module from 'lvl' to 'level' to match the implementation. Use in a keyword arg of 'lvl' results in runtime errors. (#2840) 2019-03-10 03:04:31 +01:00
Евгений
6f09ccb63d logging: inherit TimedRotatingFileHandler from Handler (#2738) 2019-01-17 13:54:59 +01:00
Michael Noseworthy
e8c1111d13 Fix logging.getLevelName() type hints (#2730)
`logging.getLevelName()` can take either an `int` and returns a `str` or
a `str` and returns an `int` when the level name (`str`) or level
(`int`) is one of the registered log levels. If the value passed in
isn't one of the registered log levels, it returns the string `"level
%s" % lvl` where `lvl` is the value passed in to the function.
2019-01-17 13:40:03 +01:00
Ilya Konstantinov
93150dc0fa LoggerAdapter.log argument lvl -> level (#2722) 2019-01-04 09:03:56 +01:00
Savo Kovačević
8542916231 Add missing currentframe to logging module (#2712) 2018-12-23 19:57:15 +01:00
Philipp Hahn
bf410fb9ef Logging (#2687)
* logging: Add logging.Logger().fatal()

fatal() is an alias for critical(): It is just another name for the same
implementation.

* logging: Fix logging.Logger().warn()

warn() was an alias for warning(), but got deprecated with Python3.
In Python2 warn() is just another name for the same method.
In Python3 they have their own implementations, which adds a deprecation
warning before calling the new function.

PS: LoggerAdapter in Python2 never has the warn() method, but Python3
still implements the deprecation wrapper function.
2018-12-17 15:39:01 +01:00
Florian Bruhin
f2e842b2d9 Fix handling of logging args (#2635)
* Use _ArgsType for logging.makeRecord
* The "args" argument is passed to LogMessage, so passing a tuple in is fine as
well.
* Use Mapping rather than Dict, see https://bugs.python.org/issue21172
2018-11-29 12:56:01 +01:00
Keith Gray
f9f4e50004 Added logging port constants to logging.handlers stub (#2617)
Closes #2616
2018-11-21 18:08:34 +01:00
Joey Wilhelm
292cbf1a35 Correct the param type for mapPriority (#2578)
Closes #2577
2018-11-01 23:55:01 +01:00
Sebastian Rittau
006a79220f Flake8 fixes (#2549)
* Fix over-indented continuation lines

* Fix under-indented continuation lines

* Fix whitespace around default operator problems

* Limit line lengths

* Fix inconsistent files
2018-10-24 07:20:53 -07:00
Jan Teske
94a1b09d1d Support PathLike arguments in the logging module. (#2500)
Since Python 3.6 logging.FileHandler's filename argument can be a
PathLike object. Same for FileHandler's subclasses.
logging.basicConfig passes its filename argument to a FileHandler, so
this can be a PathLike object too.
Finally, logging.config.fileConfig passes its fname argument to
ConfigParser.read, which also takes a PathLike since version 3.6.1.
2018-10-01 20:13:37 -07:00
Emil Hessman
d70a6cbcc0 Add missing instance attributes to logging.LoggerAdapter (#2462) 2018-09-18 20:23:04 +02:00
Matthew Christopher
110ebf4bfe Add exc_text to LogRecord (#2461) 2018-09-18 13:39:05 +02:00
Matt Robinson
c1eb946324 Add name attribute to logging.Handler (#2459)
* Add name attribute to logging.Handler
* Replace some older type comments with variable annotations around the addition line.
2018-09-17 19:36:49 +02:00
Yusuke Miyazaki
6192cce9d9 Avoid using string literals in type annotations (#2294) 2018-07-02 20:23:29 -07:00
Philipp Hahn
f8041d08db logging.BASIC_FORMAT also for python2.7 (#2283) 2018-06-27 20:14:06 -07:00
Roy Williams
52c02a2364 Allow Any type to be acceptable for the msg parameter in `logging.{info, warn, error, ...} (#1776)
The stdlib accepts any value here as long as it is castable to a string:

https://github.com/python/cpython/blob/3.6/Lib/logging/__init__.py#L336
https://github.com/python/cpython/blob/2.7/Lib/logging/__init__.py#L319-L330

Ideally this would use Protocols but I don't see them in use in typeshed yet.
2018-06-11 16:10:31 -07:00
Scott Belden
84cafafe73 TracebackType is optional (#2202) 2018-06-09 16:22:50 -07:00
Ilya Konstantinov
128a49a32d Fix LoggerAdapter.process first argument (#2153)
Standard implementation is:
```
def process(self, msg, kwargs):
    kwargs["extra"] = self.extra
    return msg, kwargs
```
so the signature is clearly `(Text, ...) -> (Text, ...)` (or `(str, ...) -> (str, ...)`, but following the other stubs here, I gather it's `Text`).
2018-05-21 08:27:16 -07:00
João Santos
afeecb478b RotatingFileHandler has a terminator property (#1952)
In python3 `RotatingFileHandler` is a subclass of `BaseRotatingHandler` which is a subclass of `FileHandler` which is a subclass of `StreamHandler` which as a `terminator` property but I'm getting a `"RotatingFileHandler" has no attribute "terminator"` error on my code.
2018-03-25 08:11:01 -07:00
Mark Amery
0c2249fbd6 Add FileHandler properties (#1834)
Fixes #1833.
2018-02-16 17:21:30 -08:00
Ben Leslie
7806420105 Fix missing colon in StreamHandler.stream type annotation (#1753)
The missing colon in the variable type annotation means that the type of stream is currently incorrectly determined to be of type ellipsis, rather than IO[str].
2017-11-18 15:57:55 -08:00
Ben Leslie
b8f7ba8e8a Corrections to logging.StreamHandler stubs (#1624) (#1625)
- Missing attribute `StreamHandler.stream`
- Missing attribute `StreamHandler.terminator`
- terminator is only available in 3.3+
2017-09-23 18:36:51 -04:00
vim345
228615b307 fix the type definition of namer function (#1498) 2017-08-07 17:36:05 -06:00
Jelle Zijlstra
2b97c02801 logging: make Logger inherit from Filterer (#1448)
Fixes #1401
2017-07-04 19:18:01 -07:00
amstree
b8a96045d9 add __init__ to Logger (#1415) 2017-06-20 13:17:26 -07:00
Matthias Kramm
6849262df6 add _levelNames to logging/__init__.py (#1404)
* add _levelNames to logging/__init__.py

* add Python 3's _levelToName and _nameToLevel
2017-06-13 08:26:14 -07:00
Alex Grönholm
37fc02ea7e Made Logger methods accept BaseExceptions for exc_info (#1376)
Loggers accept any exceptions as the exc_info argument, not only Exception subclasses.
2017-05-31 20:00:56 -07:00
Jelle Zijlstra
0aa7138c4e fixes to logging stubs (#1302)
Found with my stubcheck tool
2017-05-23 12:43:49 -07:00
amstree
028f2dd0a4 add captureWarnings to stdlib logging (#1298)
Fixes #1235
2017-05-22 15:57:40 -07:00
Jelle Zijlstra
8d1114c0c3 allow string levels in logging (#1234)
* allow string levels in logging

* remove redundant Union member
2017-05-10 07:09:08 -07:00
Jelle Zijlstra
84371e812c add Optional to exc_info and extra in logging (#1117)
None is the default value for these two arguments to logging.Logger._log (which
most other stuff in logging delegates to).

I was getting errors in my codebase because mypy now distinguishes between Any
and Optional[Any].
2017-03-29 13:45:48 -07:00
Tim Abbott
1cc3489463 logging.makeRecord returns a LogRecord. (#1100) 2017-03-25 21:48:30 -07:00
Luka Sterbic
1a2381828e Fix logging.Handler.format return type, should be str, not None (#1076) 2017-03-22 19:02:57 -07:00
Jelle Zijlstra
984307bf45 fix odd version comparisons (#988)
"> (3,)" works but looks like the code is checking for Python 4.

"<= (3, 5)" was intended to check for versions up to and including 3.5, and probably works that
way in current type checkers. However, sys.version_info is actually a 5-tuple that is greater
than (3, 5), so a hypothetical type checker that uses the full version info would interpret
this check incorrectly.

This ensures that all version_info comparisons use <, >=, ==, or !=.
2017-03-12 20:48:48 -07:00
Sebastian Meßmer
afde2fd234 Fix type stubs for logging (#972)
Add missing type for two parameters
2017-03-06 08:05:42 -08:00
Matthias Kramm
40754e312f fix import error in logging/__init__.pyi 2017-01-31 14:54:18 -08:00
Lucas Wiman
225f302135 Address str/unicode issue with logging.getLogger. (#883)
Fixes #843.
2017-01-29 11:40:20 -08:00
Lukasz Langa
c0c982ada5 Add missing Dict imports. 2016-12-21 01:15:26 -08:00
Lukasz Langa
5f416fae64 Add missing List imports. 2016-12-21 01:06:52 -08:00
Lukasz Langa
6eb97964fd Fixing flake8 E401, E402 errors 2016-12-20 00:47:51 -08:00
Lukasz Langa
147772950f Fixing flake8 E265 errors 2016-12-20 00:16:44 -08:00
Lukasz Langa
5b6a9937b2 Fixing flake8 E266 errors 2016-12-20 00:06:36 -08:00
Lukasz Langa
fe0e3744cc Fixing flake8 E261 errors 2016-12-19 22:09:35 -08:00
Matthias Kramm
7e6000949e it's threading.Lock, not threading.LockType 2016-12-12 12:02:01 -08:00
Matthias Kramm
ac97b22365 add missing Ellipsis 2016-12-12 12:02:01 -08:00
Matthias Kramm
8a5447be05 add 'Handler' and 'Filterer' classes to logging 2016-12-12 12:02:01 -08:00
Lukasz Langa
d1081b94ee [logging] Fix forward references 2016-11-30 10:48:10 -08:00
Łukasz Langa
85807ed72a logging.Formatter attributes fixed (#721)
Fixes #720.

Related changes: used a NamedTuple for time.struct_time on Python 3, used
sys.version selectors for proper typing of #716, added missing *Style classes
to logging on Python 3.
2016-11-30 09:09:05 -08:00
Peter Amstutz
d0f6a05793 Fix logging.Logger.isEnabledFor() to return bool instead of None. 2016-11-28 13:46:40 -08:00