diff options
Diffstat (limited to 'Lib/logging/__init__.py')
-rw-r--r-- | Lib/logging/__init__.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py index 4191b22..361fa88 100644 --- a/Lib/logging/__init__.py +++ b/Lib/logging/__init__.py @@ -1674,22 +1674,25 @@ def basicConfig(**kwargs): _acquireLock() try: if len(root.handlers) == 0: - filename = kwargs.get("filename") + filename = kwargs.pop("filename", None) if filename: - mode = kwargs.get("filemode", 'a') + mode = kwargs.pop("filemode", 'a') hdlr = FileHandler(filename, mode) else: - stream = kwargs.get("stream") + stream = kwargs.pop("stream", None) hdlr = StreamHandler(stream) - fs = kwargs.get("format", BASIC_FORMAT) - dfs = kwargs.get("datefmt", None) - style = kwargs.get("style", '%') + fs = kwargs.pop("format", BASIC_FORMAT) + dfs = kwargs.pop("datefmt", None) + style = kwargs.pop("style", '%') fmt = Formatter(fs, dfs, style) hdlr.setFormatter(fmt) root.addHandler(hdlr) - level = kwargs.get("level") + level = kwargs.pop("level", None) if level is not None: root.setLevel(level) + if kwargs: + s = ', '.join(kwargs.keys()) + raise ValueError('Unexpected in keyword arguments: %s' % s) finally: _releaseLock() |