summaryrefslogtreecommitdiffstats
path: root/Lib/logging
diff options
context:
space:
mode:
authorAlex Waygood <Alex.Waygood@Gmail.com>2022-05-02 15:10:02 (GMT)
committerGitHub <noreply@github.com>2022-05-02 15:10:02 (GMT)
commitab616d323dbc473f8d5563b596e882ed3ccdf77b (patch)
treed5ec3c1d089faafbc0c6828f7e25efe13a0179c0 /Lib/logging
parent031397063e9c22711abfbf90f2617c8785cfc42c (diff)
downloadcpython-ab616d323dbc473f8d5563b596e882ed3ccdf77b.zip
cpython-ab616d323dbc473f8d5563b596e882ed3ccdf77b.tar.gz
cpython-ab616d323dbc473f8d5563b596e882ed3ccdf77b.tar.bz2
gh-92128: Add `__class_getitem__` to `logging.LoggerAdapter` and `logging.StreamHandler` (#92129)
Closes #92128
Diffstat (limited to 'Lib/logging')
-rw-r--r--Lib/logging/__init__.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py
index d6315b0..432fefc 100644
--- a/Lib/logging/__init__.py
+++ b/Lib/logging/__init__.py
@@ -25,6 +25,7 @@ To use, simply 'import logging' and log away!
import sys, os, time, io, re, traceback, warnings, weakref, collections.abc
+from types import GenericAlias
from string import Template
from string import Formatter as StrFormatter
@@ -1145,6 +1146,8 @@ class StreamHandler(Handler):
name += ' '
return '<%s %s(%s)>' % (self.__class__.__name__, name, level)
+ __class_getitem__ = classmethod(GenericAlias)
+
class FileHandler(StreamHandler):
"""
@@ -1939,6 +1942,8 @@ class LoggerAdapter(object):
level = getLevelName(logger.getEffectiveLevel())
return '<%s %s (%s)>' % (self.__class__.__name__, logger.name, level)
+ __class_getitem__ = classmethod(GenericAlias)
+
root = RootLogger(WARNING)
Logger.root = root
Logger.manager = Manager(Logger.root)