chunk_id
stringlengths
36
36
source
stringclasses
35 values
source_url
stringlengths
0
290
upstream_license
stringclasses
1 value
document_id
stringlengths
36
36
chunk_index
int64
0
324k
retrieved_at
stringclasses
2 values
chunker_version
stringclasses
4 values
content_hash
stringlengths
15
64
content
stringlengths
50
44.7k
namespace
stringclasses
9 values
source_name
stringclasses
35 values
raw_text
stringlengths
50
44.7k
cleaned_text
stringlengths
50
44.7k
tags
stringclasses
49 values
collection_name
stringclasses
11 values
08e1df7d-fbf2-4f33-9683-60cc3650a4c8
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,689
supabase-export-v2
dc0f66df1f79070a
def __str__(self): from string import Template return Template(self.fmt).substitute(**self.kwargs) Either of these can be used in place of a format string, to allow {}- or $-formatting to be used to build the actual "message" part which appears in the formatted log output in place of “%(message)s” or “{message}” or “$m...
trusted_official_docs
CPython Docs
def __str__(self): from string import Template return Template(self.fmt).substitute(**self.kwargs) Either of these can be used in place of a format string, to allow {}- or $-formatting to be used to build the actual "message" part which appears in the formatted log output in place of “%(message)s” or “{message}” or “$m...
def __str__(self): from string import Template return Template(self.fmt).substitute(**self.kwargs) Either of these can be used in place of a format string, to allow {}- or $-formatting to be used to build the actual "message" part which appears in the formatted log output in place of “%(message)s” or “{message}” or “$m...
python, official-docs, cpython, P0
Local_Trusted_Corpus
092a5d6a-b775-43fd-b438-5f28badbdee5
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,898
supabase-export-v2
038a92e5399d028b
sys.stdout = LoggerWriter(logger, logging.INFO) sys.stderr = LoggerWriter(logger, logging.WARNING) You should do this *after* configuring logging for your needs. In the above example, the :func:`~logging.basicConfig` call does this (using the ``sys.stderr`` value *before* it is overwritten by a ``LoggerWriter`` instanc...
trusted_official_docs
CPython Docs
sys.stdout = LoggerWriter(logger, logging.INFO) sys.stderr = LoggerWriter(logger, logging.WARNING) You should do this *after* configuring logging for your needs. In the above example, the :func:`~logging.basicConfig` call does this (using the ``sys.stderr`` value *before* it is overwritten by a ``LoggerWriter`` instanc...
sys.stdout = LoggerWriter(logger, logging.INFO) sys.stderr = LoggerWriter(logger, logging.WARNING) You should do this *after* configuring logging for your needs. In the above example, the :func:`~logging.basicConfig` call does this (using the ``sys.stderr`` value *before* it is overwritten by a ``LoggerWriter`` instanc...
python, official-docs, cpython, P0
Local_Trusted_Corpus
0a1e5186-c97c-46c8-a297-2dd63a247a23
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,449
supabase-export-v2
afa61bbe403c2992
logging.handlers.QueueHandler(queue) # Just the one handler needed root = logging.getLogger() root.addHandler(h) # send all messages, for demo; no other level or filter logic applied. root.setLevel(logging.DEBUG) # This is the worker process top-level loop, which just logs ten events with # random intervening delays b...
trusted_official_docs
CPython Docs
logging.handlers.QueueHandler(queue) # Just the one handler needed root = logging.getLogger() root.addHandler(h) # send all messages, for demo; no other level or filter logic applied. root.setLevel(logging.DEBUG) # This is the worker process top-level loop, which just logs ten events with # random intervening delays b...
logging.handlers.QueueHandler(queue) # Just the one handler needed root = logging.getLogger() root.addHandler(h) # send all messages, for demo; no other level or filter logic applied. root.setLevel(logging.DEBUG) # This is the worker process top-level loop, which just logs ten events with # random intervening delays b...
python, official-docs, cpython, P0
Local_Trusted_Corpus
0a2fae74-d087-4d67-9813-fb16729134f3
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,948
supabase-export-v2
02f6555d9d23aa85
* Opening two files that look different, as they have different names, but are the same because one is a symbolic link to the other. * Forking a process, following which both parent and child have a reference to the same file. This might be through use of the :mod:`multiprocessing` module, for example.
trusted_official_docs
CPython Docs
* Opening two files that look different, as they have different names, but are the same because one is a symbolic link to the other. * Forking a process, following which both parent and child have a reference to the same file. This might be through use of the :mod:`multiprocessing` module, for example.
* Opening two files that look different, as they have different names, but are the same because one is a symbolic link to the other. * Forking a process, following which both parent and child have a reference to the same file. This might be through use of the :mod:`multiprocessing` module, for example.
python, official-docs, cpython, P0
Local_Trusted_Corpus
0b39264d-27e8-4e55-9e49-3d7752e4c677
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,603
supabase-export-v2
5371638f8ec80a01
def handle(self, record): if record.name == "root": logger = logging.getLogger() else: logger = logging.getLogger(record.name) if logger.isEnabledFor(record.levelno): # The process name is transformed just to show that it's the listener # doing the logging to files and console record.processName = '%s (for %s)' % (c...
trusted_official_docs
CPython Docs
def handle(self, record): if record.name == "root": logger = logging.getLogger() else: logger = logging.getLogger(record.name) if logger.isEnabledFor(record.levelno): # The process name is transformed just to show that it's the listener # doing the logging to files and console record.processName = '%s (for %s)' % (c...
def handle(self, record): if record.name == "root": logger = logging.getLogger() else: logger = logging.getLogger(record.name) if logger.isEnabledFor(record.levelno): # The process name is transformed just to show that it's the listener # doing the logging to files and console record.processName = '%s (for %s)' % (c...
python, official-docs, cpython, P0
Local_Trusted_Corpus
0b546f83-955c-4805-94c0-398254f5bf1b
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,361
supabase-export-v2
c983172fab8bc87a
default configuration uses a TCP socket on port 9020. You can use a Unix Domain socket instead of a TCP socket by doing the following: #. In :file:`listener.json`, add a ``socket`` key with the path to the domain socket you want to use. If this key is present, the listener listens on the corresponding domain socket a...
trusted_official_docs
CPython Docs
default configuration uses a TCP socket on port 9020. You can use a Unix Domain socket instead of a TCP socket by doing the following: #. In :file:`listener.json`, add a ``socket`` key with the path to the domain socket you want to use. If this key is present, the listener listens on the corresponding domain socket a...
default configuration uses a TCP socket on port 9020. You can use a Unix Domain socket instead of a TCP socket by doing the following: #. In :file:`listener.json`, add a ``socket`` key with the path to the domain socket you want to use. If this key is present, the listener listens on the corresponding domain socket a...
python, official-docs, cpython, P0
Local_Trusted_Corpus
0bed37ec-22af-4aa7-a4c7-58f65a036810
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,277
supabase-export-v2
9901b56df9acc8f9
return filter This converts the string argument passed in to a numeric level, and returns a function which only returns ``True`` if the level of the passed in record is at or below the specified level. Note that in this example I have defined the ``filter_maker`` in a test script ``main.py`` that I run from the command...
trusted_official_docs
CPython Docs
return filter This converts the string argument passed in to a numeric level, and returns a function which only returns ``True`` if the level of the passed in record is at or below the specified level. Note that in this example I have defined the ``filter_maker`` in a test script ``main.py`` that I run from the command...
return filter This converts the string argument passed in to a numeric level, and returns a function which only returns ``True`` if the level of the passed in record is at or below the specified level. Note that in this example I have defined the ``filter_maker`` in a test script ``main.py`` that I run from the command...
python, official-docs, cpython, P0
Local_Trusted_Corpus
0c00d9c3-b7d6-407a-beb3-5bc179b6fb2c
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,315
supabase-export-v2
6b595dc2ddfd6cb9
MainThread: Look out! .. note:: Although the earlier discussion wasn't specifically talking about async code, but rather about slow logging handlers, it should be noted that when logging from async code, network and even file handlers could lead to problems (blocking the event loop) because some logging is done from...
trusted_official_docs
CPython Docs
MainThread: Look out! .. note:: Although the earlier discussion wasn't specifically talking about async code, but rather about slow logging handlers, it should be noted that when logging from async code, network and even file handlers could lead to problems (blocking the event loop) because some logging is done from...
MainThread: Look out! .. note:: Although the earlier discussion wasn't specifically talking about async code, but rather about slow logging handlers, it should be noted that when logging from async code, network and even file handlers could lead to problems (blocking the event loop) because some logging is done from...
python, official-docs, cpython, P0
Local_Trusted_Corpus
0d097f2e-3be3-4bc4-9fc3-6456bdb7c637
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,335
supabase-export-v2
cfd516a6f305549f
def unPickle(self, data): return pickle.loads(data) def handleLogRecord(self, record): # if a name is specified, we use the named logger rather than the one # implied by the record. if self.server.logname is not None: name = self.server.logname else: name = record.name logger = logging.getLogger(name) # N.B. EVE...
trusted_official_docs
CPython Docs
def unPickle(self, data): return pickle.loads(data) def handleLogRecord(self, record): # if a name is specified, we use the named logger rather than the one # implied by the record. if self.server.logname is not None: name = self.server.logname else: name = record.name logger = logging.getLogger(name) # N.B. EVE...
def unPickle(self, data): return pickle.loads(data) def handleLogRecord(self, record): # if a name is specified, we use the named logger rather than the one # implied by the record. if self.server.logname is not None: name = self.server.logname else: name = record.name logger = logging.getLogger(name) # N.B. EVE...
python, official-docs, cpython, P0
Local_Trusted_Corpus
0de589a5-c695-4641-9013-ca7cb8ca1259
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,682
supabase-export-v2
9cb3c1ff168d8610
allow %-formatting as the default, to ensure interoperability with other code. Care should also be taken to call ``str(self.msg)``, just as the base implementation does. Refer to the reference documentation on :func:`setLogRecordFactory` and :class:`LogRecord` for more information.
trusted_official_docs
CPython Docs
allow %-formatting as the default, to ensure interoperability with other code. Care should also be taken to call ``str(self.msg)``, just as the base implementation does. Refer to the reference documentation on :func:`setLogRecordFactory` and :class:`LogRecord` for more information.
allow %-formatting as the default, to ensure interoperability with other code. Care should also be taken to call ``str(self.msg)``, just as the base implementation does. Refer to the reference documentation on :func:`setLogRecordFactory` and :class:`LogRecord` for more information.
python, official-docs, cpython, P0
Local_Trusted_Corpus
0f1aca12-f410-4938-9ba3-fe1383e42cf5
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,946
supabase-export-v2
b6a678157d480e3c
However, on POSIX platforms you'll not get any errors if you open the same file multiple times. This could be done accidentally, for example by: * Adding a file handler more than once which references the same file (e.g. by a copy/paste/forget-to-change error).
trusted_official_docs
CPython Docs
However, on POSIX platforms you'll not get any errors if you open the same file multiple times. This could be done accidentally, for example by: * Adding a file handler more than once which references the same file (e.g. by a copy/paste/forget-to-change error).
However, on POSIX platforms you'll not get any errors if you open the same file multiple times. This could be done accidentally, for example by: * Adding a file handler more than once which references the same file (e.g. by a copy/paste/forget-to-change error).
python, official-docs, cpython, P0
Local_Trusted_Corpus
0f74d9d5-179f-4fe1-aa7b-c7bea44c699c
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,425
supabase-export-v2
58aedd12fb4862e7
started ~/logging-contextual-webapp$ head -3 app2.log Thread-1 (process_request) app2 __main__ sheila 192.168.2.21 GET Request processing started Thread-1 (process_request) app2 webapplib sheila 192.168.2.21 GET Hello from webapplib! Thread-2 (process_request) app2 __main__ jim 192.168.2.20 GET Request processing start...
trusted_official_docs
CPython Docs
started ~/logging-contextual-webapp$ head -3 app2.log Thread-1 (process_request) app2 __main__ sheila 192.168.2.21 GET Request processing started Thread-1 (process_request) app2 webapplib sheila 192.168.2.21 GET Hello from webapplib! Thread-2 (process_request) app2 __main__ jim 192.168.2.20 GET Request processing start...
started ~/logging-contextual-webapp$ head -3 app2.log Thread-1 (process_request) app2 __main__ sheila 192.168.2.21 GET Request processing started Thread-1 (process_request) app2 webapplib sheila 192.168.2.21 GET Hello from webapplib! Thread-2 (process_request) app2 __main__ jim 192.168.2.20 GET Request processing start...
python, official-docs, cpython, P0
Local_Trusted_Corpus
12bac922-4fd0-4bff-b07d-1c4534b8a183
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,366
supabase-export-v2
79a0ae8f5286e522
of granularity you want to use in logging an application, it could be hard to manage if the number of :class:`Logger` instances becomes effectively unbounded. Using LoggerAdapters to impart contextual information ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
trusted_official_docs
CPython Docs
of granularity you want to use in logging an application, it could be hard to manage if the number of :class:`Logger` instances becomes effectively unbounded. Using LoggerAdapters to impart contextual information ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
of granularity you want to use in logging an application, it could be hard to manage if the number of :class:`Logger` instances becomes effectively unbounded. Using LoggerAdapters to impart contextual information ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
python, official-docs, cpython, P0
Local_Trusted_Corpus
12f7ba7b-cbd4-4ce0-a8e7-1de9dc5cf898
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,450
supabase-export-v2
31324fe189784a33
started: %s' % name) for i in range(10): time.sleep(random()) logger = logging.getLogger(choice(LOGGERS)) level = choice(LEVELS) message = choice(MESSAGES) logger.log(level, message) print('Worker finished: %s' % name) # Here's where the demo gets orchestrated. Create the queue, create and start # the listener, create...
trusted_official_docs
CPython Docs
started: %s' % name) for i in range(10): time.sleep(random()) logger = logging.getLogger(choice(LOGGERS)) level = choice(LEVELS) message = choice(MESSAGES) logger.log(level, message) print('Worker finished: %s' % name) # Here's where the demo gets orchestrated. Create the queue, create and start # the listener, create...
started: %s' % name) for i in range(10): time.sleep(random()) logger = logging.getLogger(choice(LOGGERS)) level = choice(LEVELS) message = choice(MESSAGES) logger.log(level, message) print('Worker finished: %s' % name) # Here's where the demo gets orchestrated. Create the queue, create and start # the listener, create...
python, official-docs, cpython, P0
Local_Trusted_Corpus
138f761b-27fa-4799-afe1-3d6a4f61b63c
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,415
supabase-export-v2
fb5b31a2d2a0939b
a webapp-specific log. """ def __init__(self, name): self.name = name handler = logging.FileHandler(name + '.log', 'w') f = InjectingFilter(self) handler.setFormatter(formatter) handler.addFilter(f) root.addHandler(handler) self.num_requests = 0 def process_request(self, request): """ This is the dummy method for pro...
trusted_official_docs
CPython Docs
a webapp-specific log. """ def __init__(self, name): self.name = name handler = logging.FileHandler(name + '.log', 'w') f = InjectingFilter(self) handler.setFormatter(formatter) handler.addFilter(f) root.addHandler(handler) self.num_requests = 0 def process_request(self, request): """ This is the dummy method for pro...
a webapp-specific log. """ def __init__(self, name): self.name = name handler = logging.FileHandler(name + '.log', 'w') f = InjectingFilter(self) handler.setFormatter(formatter) handler.addFilter(f) root.addHandler(handler) self.num_requests = 0 def process_request(self, request): """ This is the dummy method for pro...
python, official-docs, cpython, P0
Local_Trusted_Corpus
148b92da-cb81-413e-acaf-d78c539afa61
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,587
supabase-export-v2
101df64c853658ec
Using a rotator and namer to customize log rotation processing -------------------------------------------------------------- An example of how you can define a namer and rotator is given in the following runnable script, which shows gzip compression of the log file::
trusted_official_docs
CPython Docs
Using a rotator and namer to customize log rotation processing -------------------------------------------------------------- An example of how you can define a namer and rotator is given in the following runnable script, which shows gzip compression of the log file::
Using a rotator and namer to customize log rotation processing -------------------------------------------------------------- An example of how you can define a namer and rotator is given in the following runnable script, which shows gzip compression of the log file::
python, official-docs, cpython, P0
Local_Trusted_Corpus
14942964-2fa2-4685-9201-70d7a98a5411
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,272
supabase-export-v2
056acee72f65571d
{ "stdout": { "class": "logging.StreamHandler", "level": "INFO", "formatter": "simple", "stream": "ext://sys.stdout", "filters": ["warnings_and_below"] } } A filter is just a function, so we can define the ``filter_maker`` (a factory function) as follows:
trusted_official_docs
CPython Docs
{ "stdout": { "class": "logging.StreamHandler", "level": "INFO", "formatter": "simple", "stream": "ext://sys.stdout", "filters": ["warnings_and_below"] } } A filter is just a function, so we can define the ``filter_maker`` (a factory function) as follows:
{ "stdout": { "class": "logging.StreamHandler", "level": "INFO", "formatter": "simple", "stream": "ext://sys.stdout", "filters": ["warnings_and_below"] } } A filter is just a function, so we can define the ``filter_maker`` (a factory function) as follows:
python, official-docs, cpython, P0
Local_Trusted_Corpus
15283ac5-3ba1-4f5e-a168-4dba43b6c723
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,484
supabase-export-v2
330681506c9aa14f
the suffix ``.1``. Each of the existing backup files is renamed to increment the suffix (``.1`` becomes ``.2``, etc.) and the ``.6`` file is erased. Obviously this example sets the log length much too small as an extreme example. You would want to set *maxBytes* to an appropriate value.
trusted_official_docs
CPython Docs
the suffix ``.1``. Each of the existing backup files is renamed to increment the suffix (``.1`` becomes ``.2``, etc.) and the ``.6`` file is erased. Obviously this example sets the log length much too small as an extreme example. You would want to set *maxBytes* to an appropriate value.
the suffix ``.1``. Each of the existing backup files is renamed to increment the suffix (``.1`` becomes ``.2``, etc.) and the ``.6`` file is erased. Obviously this example sets the log length much too small as an extreme example. You would want to set *maxBytes* to an appropriate value.
python, official-docs, cpython, P0
Local_Trusted_Corpus
153a48a6-6910-43ec-a12a-0076e413e79b
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,949
supabase-export-v2
13896d382e48476b
process, following which both parent and child have a reference to the same file. This might be through use of the :mod:`multiprocessing` module, for example. Opening a file multiple times might *appear* to work most of the time, but can lead to a number of problems in practice:
trusted_official_docs
CPython Docs
process, following which both parent and child have a reference to the same file. This might be through use of the :mod:`multiprocessing` module, for example. Opening a file multiple times might *appear* to work most of the time, but can lead to a number of problems in practice:
process, following which both parent and child have a reference to the same file. This might be through use of the :mod:`multiprocessing` module, for example. Opening a file multiple times might *appear* to work most of the time, but can lead to a number of problems in practice:
python, official-docs, cpython, P0
Local_Trusted_Corpus
15f81412-fdac-4975-9159-cc7ae7aa9a69
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,842
supabase-export-v2
9f9a6414f23236b4
logging) as well as a worker thread doing work in the background (here, just logging messages at random levels with random short delays in between). The worker thread is implemented using Qt's ``QThread`` class rather than the :mod:`threading` module, as there are circumstances where one has to use ``QThread``, which o...
trusted_official_docs
CPython Docs
logging) as well as a worker thread doing work in the background (here, just logging messages at random levels with random short delays in between). The worker thread is implemented using Qt's ``QThread`` class rather than the :mod:`threading` module, as there are circumstances where one has to use ``QThread``, which o...
logging) as well as a worker thread doing work in the background (here, just logging messages at random levels with random short delays in between). The worker thread is implemented using Qt's ``QThread`` class rather than the :mod:`threading` module, as there are circumstances where one has to use ``QThread``, which o...
python, official-docs, cpython, P0
Local_Trusted_Corpus
16301f6f-1c44-4cd0-bddc-ff5fb1af5eb0
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,243
supabase-export-v2
1677f10c2c0db939
Logging to multiple destinations -------------------------------- Let's say you want to log to console and file with different message formats and in differing circumstances. Say you want to log messages with levels of DEBUG and higher to file, and those messages at level INFO and higher to the console. Let's also assu...
trusted_official_docs
CPython Docs
Logging to multiple destinations -------------------------------- Let's say you want to log to console and file with different message formats and in differing circumstances. Say you want to log messages with levels of DEBUG and higher to file, and those messages at level INFO and higher to the console. Let's also assu...
Logging to multiple destinations -------------------------------- Let's say you want to log to console and file with different message formats and in differing circumstances. Say you want to log messages with levels of DEBUG and higher to file, and those messages at level INFO and higher to the console. Let's also assu...
python, official-docs, cpython, P0
Local_Trusted_Corpus
163d123f-dda6-4a9d-aa16-ff1fb0a8749c
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,381
supabase-export-v2
3b5ee8f6c7a42fb6
the ``LogRecords`` passed to them, including adding additional attributes which can then be output using a suitable format string, or if needed a custom :class:`Formatter`. For example in a web application, the request being processed (or at least, the interesting parts of it) can be stored in a threadlocal (:class:`th...
trusted_official_docs
CPython Docs
the ``LogRecords`` passed to them, including adding additional attributes which can then be output using a suitable format string, or if needed a custom :class:`Formatter`. For example in a web application, the request being processed (or at least, the interesting parts of it) can be stored in a threadlocal (:class:`th...
the ``LogRecords`` passed to them, including adding additional attributes which can then be output using a suitable format string, or if needed a custom :class:`Formatter`. For example in a web application, the request being processed (or at least, the interesting parts of it) can be stored in a threadlocal (:class:`th...
python, official-docs, cpython, P0
Local_Trusted_Corpus
173a95a6-fe4f-4afa-85c4-3b10059eea01
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,235
supabase-export-v2
d84f3def5d6e4c98
Multiple handlers and formatters -------------------------------- Loggers are plain Python objects. The :meth:`~Logger.addHandler` method has no minimum or maximum quota for the number of handlers you may add. Sometimes it will be beneficial for an application to log all messages of all severities to a text file while ...
trusted_official_docs
CPython Docs
Multiple handlers and formatters -------------------------------- Loggers are plain Python objects. The :meth:`~Logger.addHandler` method has no minimum or maximum quota for the number of handlers you may add. Sometimes it will be beneficial for an application to log all messages of all severities to a text file while ...
Multiple handlers and formatters -------------------------------- Loggers are plain Python objects. The :meth:`~Logger.addHandler` method has no minimum or maximum quota for the number of handlers you may add. Sometimes it will be beneficial for an application to log all messages of all severities to a text file while ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
176f979c-9ca1-4656-aa06-99d842899732
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,408
supabase-export-v2
52c16e6554bc8b48
REQUESTS = [ Request('GET', '192.168.2.20', 'jim'), Request('POST', '192.168.3.20', 'fred'), Request('GET', '192.168.2.21', 'sheila'), Request('POST', '192.168.3.21', 'jim'), Request('GET', '192.168.2.22', 'fred'), Request('POST', '192.168.3.22', 'sheila'), ] # Note that the format string includes references to request...
trusted_official_docs
CPython Docs
REQUESTS = [ Request('GET', '192.168.2.20', 'jim'), Request('POST', '192.168.3.20', 'fred'), Request('GET', '192.168.2.21', 'sheila'), Request('POST', '192.168.3.21', 'jim'), Request('GET', '192.168.2.22', 'fred'), Request('POST', '192.168.3.22', 'sheila'), ] # Note that the format string includes references to request...
REQUESTS = [ Request('GET', '192.168.2.20', 'jim'), Request('POST', '192.168.3.20', 'fred'), Request('GET', '192.168.2.21', 'sheila'), Request('POST', '192.168.3.21', 'jim'), Request('GET', '192.168.2.22', 'fred'), Request('POST', '192.168.3.22', 'sheila'), ] # Note that the format string includes references to request...
python, official-docs, cpython, P0
Local_Trusted_Corpus
182ba903-1d43-48cb-9880-61018b9b070a
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,676
supabase-export-v2
a56b7c7681f636cf
Using particular formatting styles throughout your application -------------------------------------------------------------- In Python 3.2, the :class:`~logging.Formatter` gained a ``style`` keyword parameter which, while defaulting to ``%`` for backward compatibility, allowed the specification of ``{`` or ``$`` to su...
trusted_official_docs
CPython Docs
Using particular formatting styles throughout your application -------------------------------------------------------------- In Python 3.2, the :class:`~logging.Formatter` gained a ``style`` keyword parameter which, while defaulting to ``%`` for backward compatibility, allowed the specification of ``{`` or ``$`` to su...
Using particular formatting styles throughout your application -------------------------------------------------------------- In Python 3.2, the :class:`~logging.Formatter` gained a ``style`` keyword parameter which, while defaulting to ``%`` for backward compatibility, allowed the specification of ``{`` or ``$`` to su...
python, official-docs, cpython, P0
Local_Trusted_Corpus
1923d661-8848-4125-bae8-2cd7adfc89a7
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,691
supabase-export-v2
2884599bdbfcee6d
Examples of this approach are given below. Firstly, formatting with :meth:`str.format`:: >>> __ = BraceMessage >>> print(__('Message with {0} {1}', 2, 'placeholders')) Message with 2 placeholders >>> class Point: pass ... >>> p = Point() >>> p.x = 0.5 >>> p.y = 0.5 >>> print(__('Message with coordinates: ({point...
trusted_official_docs
CPython Docs
Examples of this approach are given below. Firstly, formatting with :meth:`str.format`:: >>> __ = BraceMessage >>> print(__('Message with {0} {1}', 2, 'placeholders')) Message with 2 placeholders >>> class Point: pass ... >>> p = Point() >>> p.x = 0.5 >>> p.y = 0.5 >>> print(__('Message with coordinates: ({point...
Examples of this approach are given below. Firstly, formatting with :meth:`str.format`:: >>> __ = BraceMessage >>> print(__('Message with {0} {1}', 2, 'placeholders')) Message with 2 placeholders >>> class Point: pass ... >>> p = Point() >>> p.x = 0.5 >>> p.y = 0.5 >>> print(__('Message with coordinates: ({point...
python, official-docs, cpython, P0
Local_Trusted_Corpus
1a075874-fcac-4271-a91c-0e7c6a5c3001
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,541
supabase-export-v2
c64dda22cd0927a0
Of course there are other ways of organizing this, for example passing in the data needed by the handler to create the socket:: class ZeroMQSocketHandler(QueueHandler): def __init__(self, uri, socktype=zmq.PUB, ctx=None): self.ctx = ctx or zmq.Context() socket = zmq.Socket(self.ctx, socktype) socket.bind(uri) supe...
trusted_official_docs
CPython Docs
Of course there are other ways of organizing this, for example passing in the data needed by the handler to create the socket:: class ZeroMQSocketHandler(QueueHandler): def __init__(self, uri, socktype=zmq.PUB, ctx=None): self.ctx = ctx or zmq.Context() socket = zmq.Socket(self.ctx, socktype) socket.bind(uri) supe...
Of course there are other ways of organizing this, for example passing in the data needed by the handler to create the socket:: class ZeroMQSocketHandler(QueueHandler): def __init__(self, uri, socktype=zmq.PUB, ctx=None): self.ctx = ctx or zmq.Context() socket = zmq.Socket(self.ctx, socktype) socket.bind(uri) supe...
python, official-docs, cpython, P0
Local_Trusted_Corpus
1a769967-7146-43e3-b81c-b7de7ad24dfb
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,758
supabase-export-v2
2920e863eed0eb33
Sending logging messages to email, with buffering ------------------------------------------------- To illustrate how you can send log messages via email, so that a set number of messages are sent per email, you can subclass :class:`~logging.handlers.BufferingHandler`. In the following example, which you can adapt to s...
trusted_official_docs
CPython Docs
Sending logging messages to email, with buffering ------------------------------------------------- To illustrate how you can send log messages via email, so that a set number of messages are sent per email, you can subclass :class:`~logging.handlers.BufferingHandler`. In the following example, which you can adapt to s...
Sending logging messages to email, with buffering ------------------------------------------------- To illustrate how you can send log messages via email, so that a set number of messages are sent per email, you can subclass :class:`~logging.handlers.BufferingHandler`. In the following example, which you can adapt to s...
python, official-docs, cpython, P0
Local_Trusted_Corpus
1ad986dd-3cb8-4db4-b358-c02c0fb37a6b
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,312
supabase-export-v2
6d9789c65857cd71
An example of using these two classes follows (imports omitted):: que = queue.Queue(-1) # no limit on size queue_handler = QueueHandler(que) handler = logging.StreamHandler() listener = QueueListener(que, handler) root = logging.getLogger() root.addHandler(queue_handler) formatter = logging.Formatter('%(threadNam...
trusted_official_docs
CPython Docs
An example of using these two classes follows (imports omitted):: que = queue.Queue(-1) # no limit on size queue_handler = QueueHandler(que) handler = logging.StreamHandler() listener = QueueListener(que, handler) root = logging.getLogger() root.addHandler(queue_handler) formatter = logging.Formatter('%(threadNam...
An example of using these two classes follows (imports omitted):: que = queue.Queue(-1) # no limit on size queue_handler = QueueHandler(que) handler = logging.StreamHandler() listener = QueueListener(que, handler) root = logging.getLogger() root.addHandler(queue_handler) formatter = logging.Formatter('%(threadNam...
python, official-docs, cpython, P0
Local_Trusted_Corpus
1afe907d-e858-4f76-84af-80ee81ceba50
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,596
supabase-export-v2
eed279c0ddac8dd9
rotated.log* rotated.log rotated.log.2.gz rotated.log.4.gz rotated.log.1.gz rotated.log.3.gz rotated.log.5.gz $ zcat rotated.log.1.gz 2023-01-20 02:28:17,767 Message no. 996 2023-01-20 02:28:17,767 Message no. 997 2023-01-20 02:28:17,767 Message no. 998 A more elaborate multiprocessing example -------------------------...
trusted_official_docs
CPython Docs
rotated.log* rotated.log rotated.log.2.gz rotated.log.4.gz rotated.log.1.gz rotated.log.3.gz rotated.log.5.gz $ zcat rotated.log.1.gz 2023-01-20 02:28:17,767 Message no. 996 2023-01-20 02:28:17,767 Message no. 997 2023-01-20 02:28:17,767 Message no. 998 A more elaborate multiprocessing example -------------------------...
rotated.log* rotated.log rotated.log.2.gz rotated.log.4.gz rotated.log.1.gz rotated.log.3.gz rotated.log.5.gz $ zcat rotated.log.1.gz 2023-01-20 02:28:17,767 Message no. 996 2023-01-20 02:28:17,767 Message no. 997 2023-01-20 02:28:17,767 Message no. 998 A more elaborate multiprocessing example -------------------------...
python, official-docs, cpython, P0
Local_Trusted_Corpus
1b0ea1c5-e8e6-4a4e-840a-4c02a84c5c1a
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,282
supabase-export-v2
073d0fda187bb027
"file": { "class": "logging.FileHandler", "formatter": "simple", "filename": "app.log", "mode": "w" } }, "root": { "level": "DEBUG", "handlers": [ "stderr", "stdout", "file" ] } } ''' def filter_maker(level): level = getattr(logging, level)
trusted_official_docs
CPython Docs
"file": { "class": "logging.FileHandler", "formatter": "simple", "filename": "app.log", "mode": "w" } }, "root": { "level": "DEBUG", "handlers": [ "stderr", "stdout", "file" ] } } ''' def filter_maker(level): level = getattr(logging, level)
"file": { "class": "logging.FileHandler", "formatter": "simple", "filename": "app.log", "mode": "w" } }, "root": { "level": "DEBUG", "handlers": [ "stderr", "stdout", "file" ] } } ''' def filter_maker(level): level = getattr(logging, level)
python, official-docs, cpython, P0
Local_Trusted_Corpus
1b2c4141-a85b-4e60-9649-bf2ce993e8fb
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,439
supabase-export-v2
5ae647ebcdadea09
configurations for the listener and the other processes in your application, and can be used as the basis for code meeting your own specific requirements:: # You'll need these imports in your own code import logging import logging.handlers import multiprocessing
trusted_official_docs
CPython Docs
configurations for the listener and the other processes in your application, and can be used as the basis for code meeting your own specific requirements:: # You'll need these imports in your own code import logging import logging.handlers import multiprocessing
configurations for the listener and the other processes in your application, and can be used as the basis for code meeting your own specific requirements:: # You'll need these imports in your own code import logging import logging.handlers import multiprocessing
python, official-docs, cpython, P0
Local_Trusted_Corpus
1b7e2db3-bdd6-4fdf-a1f2-86de674c4f21
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,806
supabase-export-v2
a654c2712600f352
* Dispatch to multiple subcommands in separate files, all logging at the same level in a consistent way * Make use of simple, minimal configuration Suppose we have a command-line application whose job is to stop, start or restart some services. This could be organised for the purposes of illustration as a file ``app.py...
trusted_official_docs
CPython Docs
* Dispatch to multiple subcommands in separate files, all logging at the same level in a consistent way * Make use of simple, minimal configuration Suppose we have a command-line application whose job is to stop, start or restart some services. This could be organised for the purposes of illustration as a file ``app.py...
* Dispatch to multiple subcommands in separate files, all logging at the same level in a consistent way * Make use of simple, minimal configuration Suppose we have a command-line application whose job is to stop, start or restart some services. This could be organised for the purposes of illustration as a file ``app.py...
python, official-docs, cpython, P0
Local_Trusted_Corpus
1beaf495-0e54-4a98-bab7-0ab3cdaf19cb
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,849
supabase-export-v2
43b58f8541c76d9a
# Signals need to be contained in a QObject or subclass in order to be correctly # initialized. # class Signaller(QtCore.QObject): signal = Signal(str, logging.LogRecord) # # Output to a Qt GUI is only supposed to happen on the main thread. So, this # handler is designed to take a slot function which is set up to run...
trusted_official_docs
CPython Docs
# Signals need to be contained in a QObject or subclass in order to be correctly # initialized. # class Signaller(QtCore.QObject): signal = Signal(str, logging.LogRecord) # # Output to a Qt GUI is only supposed to happen on the main thread. So, this # handler is designed to take a slot function which is set up to run...
# Signals need to be contained in a QObject or subclass in order to be correctly # initialized. # class Signaller(QtCore.QObject): signal = Signal(str, logging.LogRecord) # # Output to a Qt GUI is only supposed to happen on the main thread. So, this # handler is designed to take a slot function which is set up to run...
python, official-docs, cpython, P0
Local_Trusted_Corpus
1feba003-f88d-4b60-a33e-988e23f51e0e
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,265
supabase-export-v2
44792519b771fd75
.. code-block:: json { "version": 1, "disable_existing_loggers": false, "formatters": { "simple": { "format": "%(levelname)-8s - %(message)s" } }, "handlers": { "stdout": { "class": "logging.StreamHandler", "level": "INFO", "formatter": "simple", "stream": "ext://sys.stdout" }, "stderr": { "class": "log...
trusted_official_docs
CPython Docs
.. code-block:: json { "version": 1, "disable_existing_loggers": false, "formatters": { "simple": { "format": "%(levelname)-8s - %(message)s" } }, "handlers": { "stdout": { "class": "logging.StreamHandler", "level": "INFO", "formatter": "simple", "stream": "ext://sys.stdout" }, "stderr": { "class": "log...
.. code-block:: json { "version": 1, "disable_existing_loggers": false, "formatters": { "simple": { "format": "%(levelname)-8s - %(message)s" } }, "handlers": { "stdout": { "class": "logging.StreamHandler", "level": "INFO", "formatter": "simple", "stream": "ext://sys.stdout" }, "stderr": { "class": "log...
python, official-docs, cpython, P0
Local_Trusted_Corpus
1ffc8ec5-5ce5-4edc-b47d-376fca34f259
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,858
supabase-export-v2
4bf2ac7f855d50fe
level', self) self.clear_button = PB('Clear log window', self) self.handler = h = QtHandler(self.update_status) # Remember to use qThreadName rather than threadName in the format string. fs = '%(asctime)s %(qThreadName)-12s %(levelname)-8s %(message)s' formatter = logging.Formatter(fs) h.setFormatter(formatter) logg...
trusted_official_docs
CPython Docs
level', self) self.clear_button = PB('Clear log window', self) self.handler = h = QtHandler(self.update_status) # Remember to use qThreadName rather than threadName in the format string. fs = '%(asctime)s %(qThreadName)-12s %(levelname)-8s %(message)s' formatter = logging.Formatter(fs) h.setFormatter(formatter) logg...
level', self) self.clear_button = PB('Clear log window', self) self.handler = h = QtHandler(self.update_status) # Remember to use qThreadName rather than threadName in the format string. fs = '%(asctime)s %(qThreadName)-12s %(levelname)-8s %(message)s' formatter = logging.Formatter(fs) h.setFormatter(formatter) logg...
python, official-docs, cpython, P0
Local_Trusted_Corpus
2089bc17-385c-4168-9fd2-4e2d051bbc51
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,606
supabase-export-v2
8ae4f0d9f9cd277c
setup logger won't # exist in the child, so it would be created and the message # would appear - hence the "if posix" clause. logger = logging.getLogger('setup') logger.critical('Should not appear, because of disabled logger ...') stop_event.wait() listener.stop()
trusted_official_docs
CPython Docs
setup logger won't # exist in the child, so it would be created and the message # would appear - hence the "if posix" clause. logger = logging.getLogger('setup') logger.critical('Should not appear, because of disabled logger ...') stop_event.wait() listener.stop()
setup logger won't # exist in the child, so it would be created and the message # would appear - hence the "if posix" clause. logger = logging.getLogger('setup') logger.critical('Should not appear, because of disabled logger ...') stop_event.wait() listener.stop()
python, official-docs, cpython, P0
Local_Trusted_Corpus
219ba19e-d61a-4e30-a26b-044d977a6475
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,951
supabase-export-v2
4dd7b8e9775a2cd6
no such protection if concurrent writes are attempted by two different threads using two different handler instances which happen to point to the same file. * An attempt to delete a file (e.g. during file rotation) silently fails, because there is another reference pointing to it. This can lead to confusion and waste...
trusted_official_docs
CPython Docs
no such protection if concurrent writes are attempted by two different threads using two different handler instances which happen to point to the same file. * An attempt to delete a file (e.g. during file rotation) silently fails, because there is another reference pointing to it. This can lead to confusion and waste...
no such protection if concurrent writes are attempted by two different threads using two different handler instances which happen to point to the same file. * An attempt to delete a file (e.g. during file rotation) silently fails, because there is another reference pointing to it. This can lead to confusion and waste...
python, official-docs, cpython, P0
Local_Trusted_Corpus
21e3b81e-037d-4500-9867-46fc21eee61d
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,377
supabase-export-v2
bc83eaa5f8119d3a
Using objects other than dicts to pass contextual information ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ You don't need to pass an actual dict to a :class:`LoggerAdapter` - you could pass an instance of a class which implements ``__getitem__`` and ``__iter__`` so that it looks like a dict to logging....
trusted_official_docs
CPython Docs
Using objects other than dicts to pass contextual information ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ You don't need to pass an actual dict to a :class:`LoggerAdapter` - you could pass an instance of a class which implements ``__getitem__`` and ``__iter__`` so that it looks like a dict to logging....
Using objects other than dicts to pass contextual information ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ You don't need to pass an actual dict to a :class:`LoggerAdapter` - you could pass an instance of a class which implements ``__getitem__`` and ``__iter__`` so that it looks like a dict to logging....
python, official-docs, cpython, P0
Local_Trusted_Corpus
220c81c2-2a02-4e79-ba9a-7b3190a936d1
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,939
supabase-export-v2
3c0150e19927252c
.. code-block:: text 2025-07-09 06:47:33,783 DEBUG Single line 2025-07-09 06:47:33,783 DEBUG Multiple lines:\nfool me once ... 2025-07-09 06:47:33,783 DEBUG Another single line 2025-07-09 06:47:33,783 DEBUG Multiple lines:\nfool me ...\ncan't get fooled again
trusted_official_docs
CPython Docs
.. code-block:: text 2025-07-09 06:47:33,783 DEBUG Single line 2025-07-09 06:47:33,783 DEBUG Multiple lines:\nfool me once ... 2025-07-09 06:47:33,783 DEBUG Another single line 2025-07-09 06:47:33,783 DEBUG Multiple lines:\nfool me ...\ncan't get fooled again
.. code-block:: text 2025-07-09 06:47:33,783 DEBUG Single line 2025-07-09 06:47:33,783 DEBUG Multiple lines:\nfool me once ... 2025-07-09 06:47:33,783 DEBUG Another single line 2025-07-09 06:47:33,783 DEBUG Multiple lines:\nfool me ...\ncan't get fooled again
python, official-docs, cpython, P0
Local_Trusted_Corpus
23775f5c-e978-4df5-8dfc-a7931f3a9c54
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,233
supabase-export-v2
c2c4f855c0d7177f
3515 Thread-1 Hi from myfunc 3761 MainThread Hello from main 4017 Thread-1 Hi from myfunc 4513 MainThread Hello from main 4518 Thread-1 Hi from myfunc This shows the logging output interspersed as one might expect. This approach works for more threads than shown here, of course.
trusted_official_docs
CPython Docs
3515 Thread-1 Hi from myfunc 3761 MainThread Hello from main 4017 Thread-1 Hi from myfunc 4513 MainThread Hello from main 4518 Thread-1 Hi from myfunc This shows the logging output interspersed as one might expect. This approach works for more threads than shown here, of course.
3515 Thread-1 Hi from myfunc 3761 MainThread Hello from main 4017 Thread-1 Hi from myfunc 4513 MainThread Hello from main 4518 Thread-1 Hi from myfunc This shows the logging output interspersed as one might expect. This approach works for more threads than shown here, of course.
python, official-docs, cpython, P0
Local_Trusted_Corpus
23f88df7-d148-47de-b18e-4370dd2bc2eb
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,574
supabase-export-v2
1cbabe9ce0e87e35
.. code-block:: console $ python sender.py DEBUG myapp 613 Message no. 1 WARNING myapp.lib2 613 Message no. 2 CRITICAL myapp.lib2 613 Message no. 3 WARNING myapp.lib2 613 Message no. 4 CRITICAL myapp.lib1 613 Message no. 5 DEBUG myapp 613 Message no. 6 CRITICAL myapp.lib1 613 Message no. 7 INFO myapp.lib1 613 M...
trusted_official_docs
CPython Docs
.. code-block:: console $ python sender.py DEBUG myapp 613 Message no. 1 WARNING myapp.lib2 613 Message no. 2 CRITICAL myapp.lib2 613 Message no. 3 WARNING myapp.lib2 613 Message no. 4 CRITICAL myapp.lib1 613 Message no. 5 DEBUG myapp 613 Message no. 6 CRITICAL myapp.lib1 613 Message no. 7 INFO myapp.lib1 613 M...
.. code-block:: console $ python sender.py DEBUG myapp 613 Message no. 1 WARNING myapp.lib2 613 Message no. 2 CRITICAL myapp.lib2 613 Message no. 3 WARNING myapp.lib2 613 Message no. 4 CRITICAL myapp.lib1 613 Message no. 5 DEBUG myapp 613 Message no. 6 CRITICAL myapp.lib1 613 Message no. 7 INFO myapp.lib1 613 M...
python, official-docs, cpython, P0
Local_Trusted_Corpus
2501d84e-2762-4352-ac47-97ad757cb0ca
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,266
supabase-export-v2
4f118fc5e94d6409
}, "file": { "class": "logging.FileHandler", "formatter": "simple", "filename": "app.log", "mode": "w" } }, "root": { "level": "DEBUG", "handlers": [ "stderr", "stdout", "file" ] } } This configuration does *almost* what we want, except that ``sys.stdout`` would show messages of severity ``ERROR`` and only events of th...
trusted_official_docs
CPython Docs
}, "file": { "class": "logging.FileHandler", "formatter": "simple", "filename": "app.log", "mode": "w" } }, "root": { "level": "DEBUG", "handlers": [ "stderr", "stdout", "file" ] } } This configuration does *almost* what we want, except that ``sys.stdout`` would show messages of severity ``ERROR`` and only events of th...
}, "file": { "class": "logging.FileHandler", "formatter": "simple", "filename": "app.log", "mode": "w" } }, "root": { "level": "DEBUG", "handlers": [ "stderr", "stdout", "file" ] } } This configuration does *almost* what we want, except that ``sys.stdout`` would show messages of severity ``ERROR`` and only events of th...
python, official-docs, cpython, P0
Local_Trusted_Corpus
2667b970-bcdb-449b-9ef4-1e01218a5d9f
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,809
supabase-export-v2
3663e576defd8930
more services') restart_cmd.add_argument('names', metavar='NAME', nargs='+', help='Name of service to restart') options = parser.parse_args() # the code to dispatch commands could all be in this file. For the purposes # of illustration only, we implement each command in a separate module. try: mod = importlib.import_...
trusted_official_docs
CPython Docs
more services') restart_cmd.add_argument('names', metavar='NAME', nargs='+', help='Name of service to restart') options = parser.parse_args() # the code to dispatch commands could all be in this file. For the purposes # of illustration only, we implement each command in a separate module. try: mod = importlib.import_...
more services') restart_cmd.add_argument('names', metavar='NAME', nargs='+', help='Name of service to restart') options = parser.parse_args() # the code to dispatch commands could all be in this file. For the purposes # of illustration only, we implement each command in a separate module. try: mod = importlib.import_...
python, official-docs, cpython, P0
Local_Trusted_Corpus
271e6dbd-e1fb-4f89-9d36-7d28553cdc7a
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,435
supabase-export-v2
5b5386eef56e0101
Logging to a single file from multiple processes ------------------------------------------------ Although logging is thread-safe, and logging to a single file from multiple threads in a single process *is* supported, logging to a single file from *multiple processes* is *not* supported, because there is no standard wa...
trusted_official_docs
CPython Docs
Logging to a single file from multiple processes ------------------------------------------------ Although logging is thread-safe, and logging to a single file from multiple threads in a single process *is* supported, logging to a single file from *multiple processes* is *not* supported, because there is no standard wa...
Logging to a single file from multiple processes ------------------------------------------------ Although logging is thread-safe, and logging to a single file from multiple threads in a single process *is* supported, logging to a single file from *multiple processes* is *not* supported, because there is no standard wa...
python, official-docs, cpython, P0
Local_Trusted_Corpus
2869aa39-db57-4d38-811b-bbb4a2ebdb17
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,628
supabase-export-v2
752e3a88910ab657
Implementing structured logging ------------------------------- Although most logging messages are intended for reading by humans, and thus not readily machine-parseable, there might be circumstances where you want to output messages in a structured format which *is* capable of being parsed by a program (without needin...
trusted_official_docs
CPython Docs
Implementing structured logging ------------------------------- Although most logging messages are intended for reading by humans, and thus not readily machine-parseable, there might be circumstances where you want to output messages in a structured format which *is* capable of being parsed by a program (without needin...
Implementing structured logging ------------------------------- Although most logging messages are intended for reading by humans, and thus not readily machine-parseable, there might be circumstances where you want to output messages in a structured format which *is* capable of being parsed by a program (without needin...
python, official-docs, cpython, P0
Local_Trusted_Corpus
299bcdd5-afdd-4e79-a2e3-0b31463497af
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,453
supabase-export-v2
635c30810fe0c463
A variant of the above script keeps the logging in the main process, in a separate thread:: import logging import logging.config import logging.handlers from multiprocessing import Process, Queue import random import threading import time
trusted_official_docs
CPython Docs
A variant of the above script keeps the logging in the main process, in a separate thread:: import logging import logging.config import logging.handlers from multiprocessing import Process, Queue import random import threading import time
A variant of the above script keeps the logging in the main process, in a separate thread:: import logging import logging.config import logging.handlers from multiprocessing import Process, Queue import random import threading import time
python, official-docs, cpython, P0
Local_Trusted_Corpus
2a35d509-d472-4c5a-9370-546d7899379c
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,667
supabase-export-v2
48d3c0b336d8e3d4
sudo python3.3 chowntest.py $ cat chowntest.log 2013-11-05 09:34:51,128 DEBUG mylogger A debug message $ ls -l chowntest.log -rw-r--r-- 1 pulse pulse 55 2013-11-05 09:34 chowntest.log Note that this example uses Python 3.3 because that's where :func:`shutil.chown` makes an appearance. This approach should work with any...
trusted_official_docs
CPython Docs
sudo python3.3 chowntest.py $ cat chowntest.log 2013-11-05 09:34:51,128 DEBUG mylogger A debug message $ ls -l chowntest.log -rw-r--r-- 1 pulse pulse 55 2013-11-05 09:34 chowntest.log Note that this example uses Python 3.3 because that's where :func:`shutil.chown` makes an appearance. This approach should work with any...
sudo python3.3 chowntest.py $ cat chowntest.log 2013-11-05 09:34:51,128 DEBUG mylogger A debug message $ ls -l chowntest.log -rw-r--r-- 1 pulse pulse 55 2013-11-05 09:34 chowntest.log Note that this example uses Python 3.3 because that's where :func:`shutil.chown` makes an appearance. This approach should work with any...
python, official-docs, cpython, P0
Local_Trusted_Corpus
2bd312ea-1828-4a8a-a9ff-059244138ae4
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,340
supabase-export-v2
25719b1c9b21ce44
def serve_until_stopped(self): import select abort = 0 while not abort: rd, wr, ex = select.select([self.socket.fileno()], [], [], self.timeout) if rd: self.handle_request() abort = self.abort def main(): logging.basicConfig( format='%(relativeCreated)5d %(name)-15s %(levelname)-8s %(message)s') tcpserver = LogRecor...
trusted_official_docs
CPython Docs
def serve_until_stopped(self): import select abort = 0 while not abort: rd, wr, ex = select.select([self.socket.fileno()], [], [], self.timeout) if rd: self.handle_request() abort = self.abort def main(): logging.basicConfig( format='%(relativeCreated)5d %(name)-15s %(levelname)-8s %(message)s') tcpserver = LogRecor...
def serve_until_stopped(self): import select abort = 0 while not abort: rd, wr, ex = select.select([self.socket.fileno()], [], [], self.timeout) if rd: self.handle_request() abort = self.abort def main(): logging.basicConfig( format='%(relativeCreated)5d %(name)-15s %(levelname)-8s %(message)s') tcpserver = LogRecor...
python, official-docs, cpython, P0
Local_Trusted_Corpus
2e602750-49ca-4fbb-a3bd-db88a29afba7
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,754
supabase-export-v2
9f871b5428981bc4
occurs when an event is logged whose severity is ERROR or greater, but in that case, any previous events at lower severities are also logged. You can of course use the conventional means of decoration::
trusted_official_docs
CPython Docs
occurs when an event is logged whose severity is ERROR or greater, but in that case, any previous events at lower severities are also logged. You can of course use the conventional means of decoration::
occurs when an event is logged whose severity is ERROR or greater, but in that case, any previous events at lower severities are also logged. You can of course use the conventional means of decoration::
python, official-docs, cpython, P0
Local_Trusted_Corpus
2ed04e89-6d77-43d1-80a8-a64af875fec4
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,229
supabase-export-v2
2fd59b07d784f598
%(threadName)s %(message)s') info = {'stop': False} thread = threading.Thread(target=worker, args=(info,)) thread.start() while True: try: logging.debug('Hello from main') time.sleep(0.75) except KeyboardInterrupt: info['stop'] = True break thread.join() if __name__ == '__main__': main()
trusted_official_docs
CPython Docs
%(threadName)s %(message)s') info = {'stop': False} thread = threading.Thread(target=worker, args=(info,)) thread.start() while True: try: logging.debug('Hello from main') time.sleep(0.75) except KeyboardInterrupt: info['stop'] = True break thread.join() if __name__ == '__main__': main()
%(threadName)s %(message)s') info = {'stop': False} thread = threading.Thread(target=worker, args=(info,)) thread.start() while True: try: logging.debug('Hello from main') time.sleep(0.75) except KeyboardInterrupt: info['stop'] = True break thread.join() if __name__ == '__main__': main()
python, official-docs, cpython, P0
Local_Trusted_Corpus
3027b46d-2b29-4b27-8424-0bf8d74a5b7d
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,441
supabase-export-v2
00c1f0c0e6b091d0
# Next two import lines for this demo only from random import choice, random import time # # Because you'll want to define the logging configurations for listener and workers, the # listener and worker process functions take a configurer parameter which is a callable # for configuring logging for that process. These...
trusted_official_docs
CPython Docs
# Next two import lines for this demo only from random import choice, random import time # # Because you'll want to define the logging configurations for listener and workers, the # listener and worker process functions take a configurer parameter which is a callable # for configuring logging for that process. These...
# Next two import lines for this demo only from random import choice, random import time # # Because you'll want to define the logging configurations for listener and workers, the # listener and worker process functions take a configurer parameter which is a callable # for configuring logging for that process. These...
python, official-docs, cpython, P0
Local_Trusted_Corpus
30fa56d6-a2bf-41ff-8953-f46679e0c50a
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,599
supabase-export-v2
bc5cf3bed7b9887d
handlers specified in the configuration. Note that these configurations are purely illustrative, but you should be able to adapt this example to your own scenario. Here's the script - the docstrings and the comments hopefully explain how it works::
trusted_official_docs
CPython Docs
handlers specified in the configuration. Note that these configurations are purely illustrative, but you should be able to adapt this example to your own scenario. Here's the script - the docstrings and the comments hopefully explain how it works::
handlers specified in the configuration. Note that these configurations are purely illustrative, but you should be able to adapt this example to your own scenario. Here's the script - the docstrings and the comments hopefully explain how it works::
python, official-docs, cpython, P0
Local_Trusted_Corpus
310ead63-f5ae-4fb6-94a3-7cdb056a77c3
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,808
supabase-export-v2
4696d0fbf2455489
import argparse import importlib import logging import os import sys def main(args=None): scriptname = os.path.basename(__file__) parser = argparse.ArgumentParser(scriptname) levels = ('DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL') parser.add_argument('--log-level', default='INFO', choices=levels) subparsers = p...
trusted_official_docs
CPython Docs
import argparse import importlib import logging import os import sys def main(args=None): scriptname = os.path.basename(__file__) parser = argparse.ArgumentParser(scriptname) levels = ('DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL') parser.add_argument('--log-level', default='INFO', choices=levels) subparsers = p...
import argparse import importlib import logging import os import sys def main(args=None): scriptname = os.path.basename(__file__) parser = argparse.ArgumentParser(scriptname) levels = ('DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL') parser.add_argument('--log-level', default='INFO', choices=levels) subparsers = p...
python, official-docs, cpython, P0
Local_Trusted_Corpus
31192fd9-6591-45b5-8a2c-5c6f267fc4c6
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,771
supabase-export-v2
eeffa1c762aa74f5
class UTCFormatter(logging.Formatter): converter = time.gmtime and you can then use the ``UTCFormatter`` in your code instead of :class:`~logging.Formatter`. If you want to do that via configuration, you can use the :func:`~logging.config.dictConfig` API with an approach illustrated by the following complete example::
trusted_official_docs
CPython Docs
class UTCFormatter(logging.Formatter): converter = time.gmtime and you can then use the ``UTCFormatter`` in your code instead of :class:`~logging.Formatter`. If you want to do that via configuration, you can use the :func:`~logging.config.dictConfig` API with an approach illustrated by the following complete example::
class UTCFormatter(logging.Formatter): converter = time.gmtime and you can then use the ``UTCFormatter`` in your code instead of :class:`~logging.Formatter`. If you want to do that via configuration, you can use the :func:`~logging.config.dictConfig` API with an approach illustrated by the following complete example::
python, official-docs, cpython, P0
Local_Trusted_Corpus
31cae064-d18d-4908-8c6c-e77cab1e595c
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,859
supabase-export-v2
9f96db1073118016
fs = '%(asctime)s %(qThreadName)-12s %(levelname)-8s %(message)s' formatter = logging.Formatter(fs) h.setFormatter(formatter) logger.addHandler(h) # Set up to terminate the QThread when we exit app.aboutToQuit.connect(self.force_quit) # Lay out all the widgets layout = QtWidgets.QVBoxLayout(self) layout.addWidget(te)...
trusted_official_docs
CPython Docs
fs = '%(asctime)s %(qThreadName)-12s %(levelname)-8s %(message)s' formatter = logging.Formatter(fs) h.setFormatter(formatter) logger.addHandler(h) # Set up to terminate the QThread when we exit app.aboutToQuit.connect(self.force_quit) # Lay out all the widgets layout = QtWidgets.QVBoxLayout(self) layout.addWidget(te)...
fs = '%(asctime)s %(qThreadName)-12s %(levelname)-8s %(message)s' formatter = logging.Formatter(fs) h.setFormatter(formatter) logger.addHandler(h) # Set up to terminate the QThread when we exit app.aboutToQuit.connect(self.force_quit) # Lay out all the widgets layout = QtWidgets.QVBoxLayout(self) layout.addWidget(te)...
python, official-docs, cpython, P0
Local_Trusted_Corpus
3284a11f-822e-433b-bdcd-299b1fe7258d
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,736
supabase-export-v2
97f6c6f7c5260e33
Buffering logging messages and outputting them conditionally ------------------------------------------------------------ There might be situations where you want to log messages in a temporary area and only output them if a certain condition occurs. For example, you may want to start logging debug events in a function...
trusted_official_docs
CPython Docs
Buffering logging messages and outputting them conditionally ------------------------------------------------------------ There might be situations where you want to log messages in a temporary area and only output them if a certain condition occurs. For example, you may want to start logging debug events in a function...
Buffering logging messages and outputting them conditionally ------------------------------------------------------------ There might be situations where you want to log messages in a temporary area and only output them if a certain condition occurs. For example, you may want to start logging debug events in a function...
python, official-docs, cpython, P0
Local_Trusted_Corpus
32934608-cbfd-4513-a9cc-3a35b465bc01
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,584
supabase-export-v2
2f5719f456258a22
['console'], 'propagate': True, }, 'django.request': { 'handlers': ['mail_admins'], 'level': 'ERROR', 'propagate': False, }, 'myproject.custom': { 'handlers': ['console', 'mail_admins'], 'level': 'INFO', 'filters': ['special'] } } } For more information about this configuration, you can see the `relevant section <https...
trusted_official_docs
CPython Docs
['console'], 'propagate': True, }, 'django.request': { 'handlers': ['mail_admins'], 'level': 'ERROR', 'propagate': False, }, 'myproject.custom': { 'handlers': ['console', 'mail_admins'], 'level': 'INFO', 'filters': ['special'] } } } For more information about this configuration, you can see the `relevant section <https...
['console'], 'propagate': True, }, 'django.request': { 'handlers': ['mail_admins'], 'level': 'ERROR', 'propagate': False, }, 'myproject.custom': { 'handlers': ['console', 'mail_admins'], 'level': 'INFO', 'filters': ['special'] } } } For more information about this configuration, you can see the `relevant section <https...
python, official-docs, cpython, P0
Local_Trusted_Corpus
32aa47a2-356b-4e3a-bb37-fcc8925e94fa
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,362
supabase-export-v2
880d9ae3dd50972a
use. If this key is present, the listener listens on the corresponding domain socket and not on a TCP socket (the ``port`` key is ignored). #. In :file:`webapp.json`, change the socket handler configuration dictionary so that the ``host`` value is the path to the domain socket, and set the ``port`` value to ``null``.
trusted_official_docs
CPython Docs
use. If this key is present, the listener listens on the corresponding domain socket and not on a TCP socket (the ``port`` key is ignored). #. In :file:`webapp.json`, change the socket handler configuration dictionary so that the ``host`` value is the path to the domain socket, and set the ``port`` value to ``null``.
use. If this key is present, the listener listens on the corresponding domain socket and not on a TCP socket (the ``port`` key is ignored). #. In :file:`webapp.json`, change the socket handler configuration dictionary so that the ``host`` value is the path to the domain socket, and set the ``port`` value to ``null``.
python, official-docs, cpython, P0
Local_Trusted_Corpus
32dbb475-994c-43a7-9c5e-2f9ed0e19fc7
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,609
supabase-export-v2
a644d5b1c5a27f99
This initialises logging according to the specified configuration, and logs a hundred messages with random levels to randomly selected loggers. A small sleep is added to allow other processes a chance to run. This is not strictly needed, but it mixes the output from the different processes a bit more than if it's lef...
trusted_official_docs
CPython Docs
This initialises logging according to the specified configuration, and logs a hundred messages with random levels to randomly selected loggers. A small sleep is added to allow other processes a chance to run. This is not strictly needed, but it mixes the output from the different processes a bit more than if it's lef...
This initialises logging according to the specified configuration, and logs a hundred messages with random levels to randomly selected loggers. A small sleep is added to allow other processes a chance to run. This is not strictly needed, but it mixes the output from the different processes a bit more than if it's lef...
python, official-docs, cpython, P0
Local_Trusted_Corpus
32fcdcb5-7f40-492e-9aa0-659f9db5b4b2
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,866
supabase-export-v2
1773ddb7356f21de
# The functions below update the UI and run in the main thread because # that's where the slots are set up @Slot(str, logging.LogRecord) def update_status(self, status, record): color = self.COLORS.get(record.levelno, 'black') s = '<pre><font color="%s">%s</font></pre>' % (color, status) self.textedit.appendHtml(s)
trusted_official_docs
CPython Docs
# The functions below update the UI and run in the main thread because # that's where the slots are set up @Slot(str, logging.LogRecord) def update_status(self, status, record): color = self.COLORS.get(record.levelno, 'black') s = '<pre><font color="%s">%s</font></pre>' % (color, status) self.textedit.appendHtml(s)
# The functions below update the UI and run in the main thread because # that's where the slots are set up @Slot(str, logging.LogRecord) def update_status(self, status, record): color = self.COLORS.get(record.levelno, 'black') s = '<pre><font color="%s">%s</font></pre>' % (color, status) self.textedit.appendHtml(s)
python, official-docs, cpython, P0
Local_Trusted_Corpus
358546e6-7aaf-4fc8-ac62-c4f366f2fa76
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,475
supabase-export-v2
b70857965bd6763a
# Set up a specific logger with our desired output level my_logger = logging.getLogger('MyLogger') my_logger.setLevel(logging.DEBUG) # Add the log message handler to the logger handler = logging.handlers.RotatingFileHandler( LOG_FILENAME, maxBytes=20, backupCount=5)
trusted_official_docs
CPython Docs
# Set up a specific logger with our desired output level my_logger = logging.getLogger('MyLogger') my_logger.setLevel(logging.DEBUG) # Add the log message handler to the logger handler = logging.handlers.RotatingFileHandler( LOG_FILENAME, maxBytes=20, backupCount=5)
# Set up a specific logger with our desired output level my_logger = logging.getLogger('MyLogger') my_logger.setLevel(logging.DEBUG) # Add the log message handler to the logger handler = logging.handlers.RotatingFileHandler( LOG_FILENAME, maxBytes=20, backupCount=5)
python, official-docs, cpython, P0
Local_Trusted_Corpus
361c9300-9ad1-47bd-a0a8-a39524eb9712
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,210
supabase-export-v2
b3197182eee61cff
:Author: Vinay Sajip <vinay_sajip at red-dove dot com> This page contains a number of recipes related to logging, which have been found useful in the past. For links to tutorial and reference information, please see :ref:`cookbook-ref-links`.
trusted_official_docs
CPython Docs
:Author: Vinay Sajip <vinay_sajip at red-dove dot com> This page contains a number of recipes related to logging, which have been found useful in the past. For links to tutorial and reference information, please see :ref:`cookbook-ref-links`.
:Author: Vinay Sajip <vinay_sajip at red-dove dot com> This page contains a number of recipes related to logging, which have been found useful in the past. For links to tutorial and reference information, please see :ref:`cookbook-ref-links`.
python, official-docs, cpython, P0
Local_Trusted_Corpus
36b3729f-2a7d-4843-9af4-b5ee1914df2a
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,873
supabase-export-v2
6a0bbcc767c4cb62
time. Since RFC 5424 came out, as there has not been widespread deployment of it in syslog servers, the :class:`~logging.handlers.SysLogHandler` functionality has not been updated. RFC 5424 contains some useful features such as support for structured data, and if you need to be able to log to a syslog server with suppo...
trusted_official_docs
CPython Docs
time. Since RFC 5424 came out, as there has not been widespread deployment of it in syslog servers, the :class:`~logging.handlers.SysLogHandler` functionality has not been updated. RFC 5424 contains some useful features such as support for structured data, and if you need to be able to log to a syslog server with suppo...
time. Since RFC 5424 came out, as there has not been widespread deployment of it in syslog servers, the :class:`~logging.handlers.SysLogHandler` functionality has not been updated. RFC 5424 contains some useful features such as support for structured data, and if you need to be able to log to a syslog server with suppo...
python, official-docs, cpython, P0
Local_Trusted_Corpus
36b7311d-2aba-41f1-81db-35e5b5850f27
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,505
supabase-export-v2
bc502206679a4112
the above examples use ``print()`` to show how the formatting works, you would of course use ``logger.debug()`` or similar to actually log using this approach. One thing to note is that you pay no significant performance penalty with this approach: the actual formatting happens not when you make the logging call, but w...
trusted_official_docs
CPython Docs
the above examples use ``print()`` to show how the formatting works, you would of course use ``logger.debug()`` or similar to actually log using this approach. One thing to note is that you pay no significant performance penalty with this approach: the actual formatting happens not when you make the logging call, but w...
the above examples use ``print()`` to show how the formatting works, you would of course use ``logger.debug()`` or similar to actually log using this approach. One thing to note is that you pay no significant performance penalty with this approach: the actual formatting happens not when you make the logging call, but w...
python, official-docs, cpython, P0
Local_Trusted_Corpus
3730b28f-d664-4eec-8dd4-7224197ce660
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,923
supabase-export-v2
1be92311d5e383d4
record.getMessage() if '\n' not in s: super().emit(record) else: lines = s.splitlines() rec = copy.copy(record) rec.args = None for line in lines: rec.msg = line super().emit(rec) You can use the mixin as in the following script:
trusted_official_docs
CPython Docs
record.getMessage() if '\n' not in s: super().emit(record) else: lines = s.splitlines() rec = copy.copy(record) rec.args = None for line in lines: rec.msg = line super().emit(rec) You can use the mixin as in the following script:
record.getMessage() if '\n' not in s: super().emit(record) else: lines = s.splitlines() rec = copy.copy(record) rec.args = None for line in lines: rec.msg = line super().emit(rec) You can use the mixin as in the following script:
python, official-docs, cpython, P0
Local_Trusted_Corpus
37ac3e1e-3c8f-43e6-bd8c-b3baef5e2b29
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,457
supabase-export-v2
6c0552cbc2009880
point, the main process could do some useful work of its own # Once it's done that, it can wait for the workers to terminate... for wp in workers: wp.join() # And now tell the logging thread to finish up, too q.put(None) lp.join()
trusted_official_docs
CPython Docs
point, the main process could do some useful work of its own # Once it's done that, it can wait for the workers to terminate... for wp in workers: wp.join() # And now tell the logging thread to finish up, too q.put(None) lp.join()
point, the main process could do some useful work of its own # Once it's done that, it can wait for the workers to terminate... for wp in workers: wp.join() # And now tell the logging thread to finish up, too q.put(None) lp.join()
python, official-docs, cpython, P0
Local_Trusted_Corpus
37ed4db4-dde2-42fa-beb6-3e8581a9570d
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,883
supabase-export-v2
1e044956db315b22
{'bar': 'baz', 'baz': 'bozz', 'fizz': r'buzz'}, 'foo@54321': {'rab': 'baz', 'zab': 'bozz', 'zzif': r'buzz'} } extra = {'structured_data': sd} i = 1 logger.debug('Message %d', i, extra=extra) How to treat a logger like an output stream -------------------------------------------
trusted_official_docs
CPython Docs
{'bar': 'baz', 'baz': 'bozz', 'fizz': r'buzz'}, 'foo@54321': {'rab': 'baz', 'zab': 'bozz', 'zzif': r'buzz'} } extra = {'structured_data': sd} i = 1 logger.debug('Message %d', i, extra=extra) How to treat a logger like an output stream -------------------------------------------
{'bar': 'baz', 'baz': 'bozz', 'fizz': r'buzz'}, 'foo@54321': {'rab': 'baz', 'zab': 'bozz', 'zzif': r'buzz'} } extra = {'structured_data': sd} i = 1 logger.debug('Message %d', i, extra=extra) How to treat a logger like an output stream -------------------------------------------
python, official-docs, cpython, P0
Local_Trusted_Corpus
393f8f62-5561-4808-897e-dc6101dc2b87
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,426
supabase-export-v2
3c1177c091228ae5
192.168.3.21 POST Request processing started Thread-2 (process_request) app2 webapplib jim 192.168.2.20 GET Hello from webapplib! Thread-3 (process_request) app1 webapplib jim 192.168.3.21 POST Hello from webapplib! Thread-4 (process_request) app2 __main__ fred 192.168.2.22 GET Request processing started Thread-5 (pro...
trusted_official_docs
CPython Docs
192.168.3.21 POST Request processing started Thread-2 (process_request) app2 webapplib jim 192.168.2.20 GET Hello from webapplib! Thread-3 (process_request) app1 webapplib jim 192.168.3.21 POST Hello from webapplib! Thread-4 (process_request) app2 __main__ fred 192.168.2.22 GET Request processing started Thread-5 (pro...
192.168.3.21 POST Request processing started Thread-2 (process_request) app2 webapplib jim 192.168.2.20 GET Hello from webapplib! Thread-3 (process_request) app1 webapplib jim 192.168.3.21 POST Hello from webapplib! Thread-4 (process_request) app2 __main__ fred 192.168.2.22 GET Request processing started Thread-5 (pro...
python, official-docs, cpython, P0
Local_Trusted_Corpus
3980a81d-3480-4aed-8c8e-51a847ef48f4
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,395
supabase-export-v2
3861636ec0ab7834
The following example shows how, in a multi-threaded environment, logs can populated with contextual information such as, for example, request attributes handled by web applications. For the purposes of illustration, say that you have different web applications, each independent of the other but running in the same Pyt...
trusted_official_docs
CPython Docs
The following example shows how, in a multi-threaded environment, logs can populated with contextual information such as, for example, request attributes handled by web applications. For the purposes of illustration, say that you have different web applications, each independent of the other but running in the same Pyt...
The following example shows how, in a multi-threaded environment, logs can populated with contextual information such as, for example, request attributes handled by web applications. For the purposes of illustration, say that you have different web applications, each independent of the other but running in the same Pyt...
python, official-docs, cpython, P0
Local_Trusted_Corpus
3997ae09-9543-4e4c-988a-8e4fffa3fdde
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,367
supabase-export-v2
d981f0640053c241
Using LoggerAdapters to impart contextual information ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ An easy way in which you can pass contextual information to be output along with logging event information is to use the :class:`LoggerAdapter` class. This class is designed to look like a :class:`Logger`, so tha...
trusted_official_docs
CPython Docs
Using LoggerAdapters to impart contextual information ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ An easy way in which you can pass contextual information to be output along with logging event information is to use the :class:`LoggerAdapter` class. This class is designed to look like a :class:`Logger`, so tha...
Using LoggerAdapters to impart contextual information ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ An easy way in which you can pass contextual information to be output along with logging event information is to use the :class:`LoggerAdapter` class. This class is designed to look like a :class:`Logger`, so tha...
python, official-docs, cpython, P0
Local_Trusted_Corpus
3a6ad7f6-e509-4697-9094-b3b136687165
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,733
supabase-export-v2
9547c6efe4e0df8e
When run, this script should say "Hello" and then "Goodbye" in a female voice. The above approach can, of course, be adapted to other TTS systems and even other systems altogether which can process messages via external programs run from a command line.
trusted_official_docs
CPython Docs
When run, this script should say "Hello" and then "Goodbye" in a female voice. The above approach can, of course, be adapted to other TTS systems and even other systems altogether which can process messages via external programs run from a command line.
When run, this script should say "Hello" and then "Goodbye" in a female voice. The above approach can, of course, be adapted to other TTS systems and even other systems altogether which can process messages via external programs run from a command line.
python, official-docs, cpython, P0
Local_Trusted_Corpus
3b5cb2d7-d4a1-464d-9ac7-5094d56aa52f
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,739
supabase-export-v2
f621738e588af5eb
a parameter to ``foo`` which, if true, will log at ERROR and CRITICAL levels - otherwise, it only logs at DEBUG, INFO and WARNING levels. The script just arranges to decorate ``foo`` with a decorator which will do the conditional logging that's required. The decorator takes a logger as a parameter and attaches a memory...
trusted_official_docs
CPython Docs
a parameter to ``foo`` which, if true, will log at ERROR and CRITICAL levels - otherwise, it only logs at DEBUG, INFO and WARNING levels. The script just arranges to decorate ``foo`` with a decorator which will do the conditional logging that's required. The decorator takes a logger as a parameter and attaches a memory...
a parameter to ``foo`` which, if true, will log at ERROR and CRITICAL levels - otherwise, it only logs at DEBUG, INFO and WARNING levels. The script just arranges to decorate ``foo`` with a decorator which will do the conditional logging that's required. The decorator takes a logger as a parameter and attaches a memory...
python, official-docs, cpython, P0
Local_Trusted_Corpus
3bcfcb09-c8eb-4848-8b61-c7fa17cfb8c9
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,454
supabase-export-v2
fa8cf552210c6717
import logging import logging.config import logging.handlers from multiprocessing import Process, Queue import random import threading import time def logger_thread(q): while True: record = q.get() if record is None: break logger = logging.getLogger(record.name) logger.handle(record)
trusted_official_docs
CPython Docs
import logging import logging.config import logging.handlers from multiprocessing import Process, Queue import random import threading import time def logger_thread(q): while True: record = q.get() if record is None: break logger = logging.getLogger(record.name) logger.handle(record)
import logging import logging.config import logging.handlers from multiprocessing import Process, Queue import random import threading import time def logger_thread(q): while True: record = q.get() if record is None: break logger = logging.getLogger(record.name) logger.handle(record)
python, official-docs, cpython, P0
Local_Trusted_Corpus
3c1cc7d7-9dfa-40ac-a2f7-31d3b4738ba1
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,517
supabase-export-v2
5ee0ad411665d24e
Customizing ``LogRecord`` ------------------------- Every logging event is represented by a :class:`LogRecord` instance. When an event is logged and not filtered out by a logger's level, a :class:`LogRecord` is created, populated with information about the event and then passed to the handlers for that logger (and its ...
trusted_official_docs
CPython Docs
Customizing ``LogRecord`` ------------------------- Every logging event is represented by a :class:`LogRecord` instance. When an event is logged and not filtered out by a logger's level, a :class:`LogRecord` is created, populated with information about the event and then passed to the handlers for that logger (and its ...
Customizing ``LogRecord`` ------------------------- Every logging event is represented by a :class:`LogRecord` instance. When an event is logged and not filtered out by a logger's level, a :class:`LogRecord` is created, populated with information about the event and then passed to the handlers for that logger (and its ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
3cf4cb71-dac6-4fd6-b39a-ca0c823d77f8
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,360
supabase-export-v2
bc3d27e7b938b481
You may need to tweak the configuration files in the unlikely event that the configured ports clash with something else in your test environment. The default configuration uses a TCP socket on port 9020. You can use a Unix Domain socket instead of a TCP socket by doing the following:
trusted_official_docs
CPython Docs
You may need to tweak the configuration files in the unlikely event that the configured ports clash with something else in your test environment. The default configuration uses a TCP socket on port 9020. You can use a Unix Domain socket instead of a TCP socket by doing the following:
You may need to tweak the configuration files in the unlikely event that the configured ports clash with something else in your test environment. The default configuration uses a TCP socket on port 9020. You can use a Unix Domain socket instead of a TCP socket by doing the following:
python, official-docs, cpython, P0
Local_Trusted_Corpus
3d287b71-f41e-4153-a8bb-fb82f4921869
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,358
supabase-export-v2
6c88136539ee3e96
matching the pattern :file:`app.log*`. They won't be in any particular order, since they have been handled concurrently by different worker processes in a non-deterministic way. #. You can shut down the listener and the web application by running ``venv/bin/supervisorctl -c supervisor.conf shutdown``.
trusted_official_docs
CPython Docs
matching the pattern :file:`app.log*`. They won't be in any particular order, since they have been handled concurrently by different worker processes in a non-deterministic way. #. You can shut down the listener and the web application by running ``venv/bin/supervisorctl -c supervisor.conf shutdown``.
matching the pattern :file:`app.log*`. They won't be in any particular order, since they have been handled concurrently by different worker processes in a non-deterministic way. #. You can shut down the listener and the web application by running ``venv/bin/supervisorctl -c supervisor.conf shutdown``.
python, official-docs, cpython, P0
Local_Trusted_Corpus
3e91b3d5-3eca-42a6-82f3-19e3e7104c84
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,339
supabase-export-v2
927b16af0ffafa8a
def __init__(self, host='localhost', port=logging.handlers.DEFAULT_TCP_LOGGING_PORT, handler=LogRecordStreamHandler): socketserver.ThreadingTCPServer.__init__(self, (host, port), handler) self.abort = 0 self.timeout = 1 self.logname = None def serve_until_stopped(self): import select abort = 0 while not abort: rd, ...
trusted_official_docs
CPython Docs
def __init__(self, host='localhost', port=logging.handlers.DEFAULT_TCP_LOGGING_PORT, handler=LogRecordStreamHandler): socketserver.ThreadingTCPServer.__init__(self, (host, port), handler) self.abort = 0 self.timeout = 1 self.logname = None def serve_until_stopped(self): import select abort = 0 while not abort: rd, ...
def __init__(self, host='localhost', port=logging.handlers.DEFAULT_TCP_LOGGING_PORT, handler=LogRecordStreamHandler): socketserver.ThreadingTCPServer.__init__(self, (host, port), handler) self.abort = 0 self.timeout = 1 self.logname = None def serve_until_stopped(self): import select abort = 0 while not abort: rd, ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
3f943e44-4a6d-464f-88be-592fc5001ace
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,369
supabase-export-v2
e8d3f9e13908f1e3
of :class:`Logger` passed to its constructor, and arranges to pass the contextual information in the delegated call. Here's a snippet from the code of :class:`LoggerAdapter`:: def debug(self, msg, /, *args, **kwargs): """ Delegate a debug call to the underlying logger, after adding contextual information from this a...
trusted_official_docs
CPython Docs
of :class:`Logger` passed to its constructor, and arranges to pass the contextual information in the delegated call. Here's a snippet from the code of :class:`LoggerAdapter`:: def debug(self, msg, /, *args, **kwargs): """ Delegate a debug call to the underlying logger, after adding contextual information from this a...
of :class:`Logger` passed to its constructor, and arranges to pass the contextual information in the delegated call. Here's a snippet from the code of :class:`LoggerAdapter`:: def debug(self, msg, /, *args, **kwargs): """ Delegate a debug call to the underlying logger, after adding contextual information from this a...
python, official-docs, cpython, P0
Local_Trusted_Corpus
40389c7d-c99e-4807-b2b4-e2b5004fad60
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,729
supabase-export-v2
8e53017eb24d9e7b
slowly in a female English voice cmd = ['espeak', '-s150', '-ven+f3', msg] p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) # wait for the program to finish p.communicate() def configure_logging(): h = TTSHandler() root = logging.getLogger() root.addHandler(h) # the default formatter just...
trusted_official_docs
CPython Docs
slowly in a female English voice cmd = ['espeak', '-s150', '-ven+f3', msg] p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) # wait for the program to finish p.communicate() def configure_logging(): h = TTSHandler() root = logging.getLogger() root.addHandler(h) # the default formatter just...
slowly in a female English voice cmd = ['espeak', '-s150', '-ven+f3', msg] p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) # wait for the program to finish p.communicate() def configure_logging(): h = TTSHandler() root = logging.getLogger() root.addHandler(h) # the default formatter just...
python, official-docs, cpython, P0
Local_Trusted_Corpus
4046ce15-113a-4054-9213-67c94541123c
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,608
supabase-export-v2
2fcaf888b3984a68
spawned for the purpose of illustration. In practice, they could be a heterogeneous bunch of processes rather than ones which are identical to each other. This initialises logging according to the specified configuration, and logs a hundred messages with random levels to randomly selected loggers.
trusted_official_docs
CPython Docs
spawned for the purpose of illustration. In practice, they could be a heterogeneous bunch of processes rather than ones which are identical to each other. This initialises logging according to the specified configuration, and logs a hundred messages with random levels to randomly selected loggers.
spawned for the purpose of illustration. In practice, they could be a heterogeneous bunch of processes rather than ones which are identical to each other. This initialises logging according to the specified configuration, and logs a hundred messages with random levels to randomly selected loggers.
python, official-docs, cpython, P0
Local_Trusted_Corpus
418f43c6-ab8c-4a95-8357-2ba83e496c3c
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,571
supabase-export-v2
3ce219666501f617
def close(self): self.queue.close() logging.getLogger('pynng').propagate = False handler = NNGSocketHandler(DEFAULT_ADDR) # Make sure the process ID is in the output logging.basicConfig(level=logging.DEBUG, handlers=[logging.StreamHandler(), handler], format='%(levelname)-8s %(name)10s %(process)6s %(message)s') ...
trusted_official_docs
CPython Docs
def close(self): self.queue.close() logging.getLogger('pynng').propagate = False handler = NNGSocketHandler(DEFAULT_ADDR) # Make sure the process ID is in the output logging.basicConfig(level=logging.DEBUG, handlers=[logging.StreamHandler(), handler], format='%(levelname)-8s %(name)10s %(process)6s %(message)s') ...
def close(self): self.queue.close() logging.getLogger('pynng').propagate = False handler = NNGSocketHandler(DEFAULT_ADDR) # Make sure the process ID is in the output logging.basicConfig(level=logging.DEBUG, handlers=[logging.StreamHandler(), handler], format='%(levelname)-8s %(name)10s %(process)6s %(message)s') ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
4238940c-aab8-4ec4-8e00-e8f37168f310
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,247
supabase-export-v2
26e91a1bff8c1180
# Now, we can log to the root logger, or any other logger. First the root... logging.info('Jackdaws love my big sphinx of quartz.') # Now, define a couple of other loggers which might represent areas in your # application:
trusted_official_docs
CPython Docs
# Now, we can log to the root logger, or any other logger. First the root... logging.info('Jackdaws love my big sphinx of quartz.') # Now, define a couple of other loggers which might represent areas in your # application:
# Now, we can log to the root logger, or any other logger. First the root... logging.info('Jackdaws love my big sphinx of quartz.') # Now, define a couple of other loggers which might represent areas in your # application:
python, official-docs, cpython, P0
Local_Trusted_Corpus
423b0f07-f7e3-471b-ab09-a9a8b9222a1a
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,823
supabase-export-v2
e6ce70c08d245959
and ' + services[i + 2:] logger.debug('About to restart %s', services) # actually do the command processing here ... logger.info('Restarted the %s service%s.', services, plural) If we run this application with the default log level, we get output like this:
trusted_official_docs
CPython Docs
and ' + services[i + 2:] logger.debug('About to restart %s', services) # actually do the command processing here ... logger.info('Restarted the %s service%s.', services, plural) If we run this application with the default log level, we get output like this:
and ' + services[i + 2:] logger.debug('About to restart %s', services) # actually do the command processing here ... logger.info('Restarted the %s service%s.', services, plural) If we run this application with the default log level, we get output like this:
python, official-docs, cpython, P0
Local_Trusted_Corpus
4420f540-8d09-4469-bc49-9d29259ca872
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,373
supabase-export-v2
d585207d1f104390
a 'connid' key, whose value in brackets is prepended to the log message. """ def process(self, msg, kwargs): return '[%s] %s' % (self.extra['connid'], msg), kwargs which you can use like this::
trusted_official_docs
CPython Docs
a 'connid' key, whose value in brackets is prepended to the log message. """ def process(self, msg, kwargs): return '[%s] %s' % (self.extra['connid'], msg), kwargs which you can use like this::
a 'connid' key, whose value in brackets is prepended to the log message. """ def process(self, msg, kwargs): return '[%s] %s' % (self.extra['connid'], msg), kwargs which you can use like this::
python, official-docs, cpython, P0
Local_Trusted_Corpus
447319c7-df83-4b56-b331-c09c3f95b5f2
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,614
supabase-export-v2
f666755095993af8
{ 'handlers': ['console', 'file', 'errors'], 'level': 'DEBUG' } } # Log some initial events, just to show that logging in the parent works # normally. logging.config.dictConfig(config_initial) logger = logging.getLogger('setup') logger.info('About to create workers ...') workers = [] for i in range(5): wp = Proces...
trusted_official_docs
CPython Docs
{ 'handlers': ['console', 'file', 'errors'], 'level': 'DEBUG' } } # Log some initial events, just to show that logging in the parent works # normally. logging.config.dictConfig(config_initial) logger = logging.getLogger('setup') logger.info('About to create workers ...') workers = [] for i in range(5): wp = Proces...
{ 'handlers': ['console', 'file', 'errors'], 'level': 'DEBUG' } } # Log some initial events, just to show that logging in the parent works # normally. logging.config.dictConfig(config_initial) logger = logging.getLogger('setup') logger.info('About to create workers ...') workers = [] for i in range(5): wp = Proces...
python, official-docs, cpython, P0
Local_Trusted_Corpus
46306880-1ad4-47ea-95f2-40553bc17ae3
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,624
supabase-export-v2
6f1a6c8aa4cf1b3d
The Unicode code point U+FEFF, when encoded using UTF-8, will be encoded as a UTF-8 BOM -- the byte-string ``b'\xef\xbb\xbf'``. #. Replace the ASCII section with whatever placeholders you like, but make sure that the data that appears in there after substitution is always ASCII (that way, it will remain unchanged aft...
trusted_official_docs
CPython Docs
The Unicode code point U+FEFF, when encoded using UTF-8, will be encoded as a UTF-8 BOM -- the byte-string ``b'\xef\xbb\xbf'``. #. Replace the ASCII section with whatever placeholders you like, but make sure that the data that appears in there after substitution is always ASCII (that way, it will remain unchanged aft...
The Unicode code point U+FEFF, when encoded using UTF-8, will be encoded as a UTF-8 BOM -- the byte-string ``b'\xef\xbb\xbf'``. #. Replace the ASCII section with whatever placeholders you like, but make sure that the data that appears in there after substitution is always ASCII (that way, it will remain unchanged aft...
python, official-docs, cpython, P0
Local_Trusted_Corpus
46e6cc96-f462-456c-9cec-637c41be50f5
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,598
supabase-export-v2
9132a133e335941a
multiprocessing using configuration files. The configurations are fairly simple, but serve to illustrate how more complex ones could be implemented in a real multiprocessing scenario. In the example, the main process spawns a listener process and some worker processes. Each of the main process, the listener and the wor...
trusted_official_docs
CPython Docs
multiprocessing using configuration files. The configurations are fairly simple, but serve to illustrate how more complex ones could be implemented in a real multiprocessing scenario. In the example, the main process spawns a listener process and some worker processes. Each of the main process, the listener and the wor...
multiprocessing using configuration files. The configurations are fairly simple, but serve to illustrate how more complex ones could be implemented in a real multiprocessing scenario. In the example, the main process spawns a listener process and some worker processes. Each of the main process, the listener and the wor...
python, official-docs, cpython, P0
Local_Trusted_Corpus
471f689a-94bc-4a3c-939a-78396fd2f704
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,919
supabase-export-v2
a1905468176508ae
How to uniformly handle newlines in logging output -------------------------------------------------- Usually, messages that are logged (say to console or file) consist of a single line of text. However, sometimes there is a need to handle messages with multiple lines - whether because a logging format string contains ...
trusted_official_docs
CPython Docs
How to uniformly handle newlines in logging output -------------------------------------------------- Usually, messages that are logged (say to console or file) consist of a single line of text. However, sometimes there is a need to handle messages with multiple lines - whether because a logging format string contains ...
How to uniformly handle newlines in logging output -------------------------------------------------- Usually, messages that are logged (say to console or file) consist of a single line of text. However, sometimes there is a need to handle messages with multiple lines - whether because a logging format string contains ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
47629b87-1fb7-4c38-9d61-ec0871ddbc5e
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,577
supabase-export-v2
d069c607f54d0dd4
.. code-block:: console $ python sender.py INFO myapp.lib2 657 Message no. 1 CRITICAL myapp.lib2 657 Message no. 2 CRITICAL myapp 657 Message no. 3 CRITICAL myapp.lib1 657 Message no. 4 INFO myapp.lib1 657 Message no. 5 WARNING myapp.lib2 657 Message no. 6 CRITICAL myapp 657 Message no. 7 DEBUG myapp.lib1 657 M...
trusted_official_docs
CPython Docs
.. code-block:: console $ python sender.py INFO myapp.lib2 657 Message no. 1 CRITICAL myapp.lib2 657 Message no. 2 CRITICAL myapp 657 Message no. 3 CRITICAL myapp.lib1 657 Message no. 4 INFO myapp.lib1 657 Message no. 5 WARNING myapp.lib2 657 Message no. 6 CRITICAL myapp 657 Message no. 7 DEBUG myapp.lib1 657 M...
.. code-block:: console $ python sender.py INFO myapp.lib2 657 Message no. 1 CRITICAL myapp.lib2 657 Message no. 2 CRITICAL myapp 657 Message no. 3 CRITICAL myapp.lib1 657 Message no. 4 INFO myapp.lib1 657 Message no. 5 WARNING myapp.lib2 657 Message no. 6 CRITICAL myapp 657 Message no. 7 DEBUG myapp.lib1 657 M...
python, official-docs, cpython, P0
Local_Trusted_Corpus
478e0c79-01c7-44fb-ad41-a4a276fc06f6
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,708
supabase-export-v2
4dc71f50eccc8e03
A couple of extra points to note: * If you can't refer to the callable directly in the configuration (e.g. if it lives in a different module, and you can't import it directly where the configuration dictionary is), you can use the form ``ext://...`` as described in :ref:`logging-config-dict-externalobj`. For example...
trusted_official_docs
CPython Docs
A couple of extra points to note: * If you can't refer to the callable directly in the configuration (e.g. if it lives in a different module, and you can't import it directly where the configuration dictionary is), you can use the form ``ext://...`` as described in :ref:`logging-config-dict-externalobj`. For example...
A couple of extra points to note: * If you can't refer to the callable directly in the configuration (e.g. if it lives in a different module, and you can't import it directly where the configuration dictionary is), you can use the form ``ext://...`` as described in :ref:`logging-config-dict-externalobj`. For example...
python, official-docs, cpython, P0
Local_Trusted_Corpus
48272b5a-e31c-4986-a835-774b7069a11c
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,317
supabase-export-v2
370a9e2adc08a961
listener compares the level of each message with the handler's level, and only passes a message to a handler if it's appropriate to do so. .. versionchanged:: 3.14 The :class:`QueueListener` can be started (and stopped) via the :keyword:`with` statement. For example:
trusted_official_docs
CPython Docs
listener compares the level of each message with the handler's level, and only passes a message to a handler if it's appropriate to do so. .. versionchanged:: 3.14 The :class:`QueueListener` can be started (and stopped) via the :keyword:`with` statement. For example:
listener compares the level of each message with the handler's level, and only passes a message to a handler if it's appropriate to do so. .. versionchanged:: 3.14 The :class:`QueueListener` can be started (and stopped) via the :keyword:`with` statement. For example:
python, official-docs, cpython, P0
Local_Trusted_Corpus
48478097-7e2f-44f7-b85f-1f7d45ffe4b5
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,761
supabase-export-v2
371c84fab8084ba3
import logging import logging.handlers import smtplib class BufferingSMTPHandler(logging.handlers.BufferingHandler): def __init__(self, mailhost, port, username, password, fromaddr, toaddrs, subject, capacity): logging.handlers.BufferingHandler.__init__(self, capacity) self.mailhost = mailhost self.mailport = port...
trusted_official_docs
CPython Docs
import logging import logging.handlers import smtplib class BufferingSMTPHandler(logging.handlers.BufferingHandler): def __init__(self, mailhost, port, username, password, fromaddr, toaddrs, subject, capacity): logging.handlers.BufferingHandler.__init__(self, capacity) self.mailhost = mailhost self.mailport = port...
import logging import logging.handlers import smtplib class BufferingSMTPHandler(logging.handlers.BufferingHandler): def __init__(self, mailhost, port, username, password, fromaddr, toaddrs, subject, capacity): logging.handlers.BufferingHandler.__init__(self, capacity) self.mailhost = mailhost self.mailport = port...
python, official-docs, cpython, P0
Local_Trusted_Corpus
4880ca5a-c2dd-485b-8250-f31e14bd1d0f
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,956
supabase-export-v2
39c30b4c2aa673fa
Adding handlers other than :class:`~logging.NullHandler` to a logger in a library ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Configuring logging by adding handlers, formatters and filters is the responsibility of the application developer, not the library developer. If you are mai...
trusted_official_docs
CPython Docs
Adding handlers other than :class:`~logging.NullHandler` to a logger in a library ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Configuring logging by adding handlers, formatters and filters is the responsibility of the application developer, not the library developer. If you are mai...
Adding handlers other than :class:`~logging.NullHandler` to a logger in a library ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Configuring logging by adding handlers, formatters and filters is the responsibility of the application developer, not the library developer. If you are mai...
python, official-docs, cpython, P0
Local_Trusted_Corpus
489a669e-ef3c-4839-8957-7d582af90d08
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,561
supabase-export-v2
5c90761ee4eec3b3
def enqueue_sentinel(self): # Not used in this implementation, as the socket isn't really a # queue pass logging.getLogger('pynng').propagate = False listener = NNGSocketListener(DEFAULT_ADDR, logging.StreamHandler(), topics=b'') listener.start() print('Press Ctrl-C to stop.') try: while True: pass except Keyboa...
trusted_official_docs
CPython Docs
def enqueue_sentinel(self): # Not used in this implementation, as the socket isn't really a # queue pass logging.getLogger('pynng').propagate = False listener = NNGSocketListener(DEFAULT_ADDR, logging.StreamHandler(), topics=b'') listener.start() print('Press Ctrl-C to stop.') try: while True: pass except Keyboa...
def enqueue_sentinel(self): # Not used in this implementation, as the socket isn't really a # queue pass logging.getLogger('pynng').propagate = False listener = NNGSocketListener(DEFAULT_ADDR, logging.StreamHandler(), topics=b'') listener.start() print('Press Ctrl-C to stop.') try: while True: pass except Keyboa...
python, official-docs, cpython, P0
Local_Trusted_Corpus
48d6f1b3-31c0-4724-b89f-25ee91e7769c
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,354
supabase-export-v2
897a2c79409983fa
#. Unzip the above files from the archive into a scratch directory. #. In the scratch directory, run ``bash prepare.sh`` to get things ready. This creates a :file:`run` subdirectory to contain Supervisor-related and log files, and a :file:`venv` subdirectory to contain a virtual environment into which ``bottle``, ``g...
trusted_official_docs
CPython Docs
#. Unzip the above files from the archive into a scratch directory. #. In the scratch directory, run ``bash prepare.sh`` to get things ready. This creates a :file:`run` subdirectory to contain Supervisor-related and log files, and a :file:`venv` subdirectory to contain a virtual environment into which ``bottle``, ``g...
#. Unzip the above files from the archive into a scratch directory. #. In the scratch directory, run ``bash prepare.sh`` to get things ready. This creates a :file:`run` subdirectory to contain Supervisor-related and log files, and a :file:`venv` subdirectory to contain a virtual environment into which ``bottle``, ``g...
python, official-docs, cpython, P0
Local_Trusted_Corpus
4971993f-9024-4c20-a475-67344076d611
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,536
supabase-export-v2
78754e00b9bcd080
kinds of queues, for example a ZeroMQ 'publish' socket. In the example below,the socket is created separately and passed to the handler (as its 'queue'):: import zmq # using pyzmq, the Python binding for ZeroMQ import json # for serializing records portably
trusted_official_docs
CPython Docs
kinds of queues, for example a ZeroMQ 'publish' socket. In the example below,the socket is created separately and passed to the handler (as its 'queue'):: import zmq # using pyzmq, the Python binding for ZeroMQ import json # for serializing records portably
kinds of queues, for example a ZeroMQ 'publish' socket. In the example below,the socket is created separately and passed to the handler (as its 'queue'):: import zmq # using pyzmq, the Python binding for ZeroMQ import json # for serializing records portably
python, official-docs, cpython, P0
Local_Trusted_Corpus
49d6cdfd-8b60-4083-bf7b-1c4629c82c4e
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,336
supabase-export-v2
41bf0953cb67abbe
AFTER logger-level filtering. If you want # to do filtering, do it at the client end to save wasting # cycles and network bandwidth! logger.handle(record) class LogRecordSocketReceiver(socketserver.ThreadingTCPServer): """ Simple TCP socket-based logging receiver suitable for testing. """
trusted_official_docs
CPython Docs
AFTER logger-level filtering. If you want # to do filtering, do it at the client end to save wasting # cycles and network bandwidth! logger.handle(record) class LogRecordSocketReceiver(socketserver.ThreadingTCPServer): """ Simple TCP socket-based logging receiver suitable for testing. """
AFTER logger-level filtering. If you want # to do filtering, do it at the client end to save wasting # cycles and network bandwidth! logger.handle(record) class LogRecordSocketReceiver(socketserver.ThreadingTCPServer): """ Simple TCP socket-based logging receiver suitable for testing. """
python, official-docs, cpython, P0
Local_Trusted_Corpus
49ecaa48-4946-4bbc-b0d4-d9afa6e57241
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,451
supabase-export-v2
73d92a140e212bdc
multiprocessing.Process(target=listener_process, args=(queue, listener_configurer)) listener.start() workers = [] for i in range(10): worker = multiprocessing.Process(target=worker_process, args=(queue, worker_configurer)) workers.append(worker) worker.start() for w in workers: w.join() queue.put_nowait(None) listener....
trusted_official_docs
CPython Docs
multiprocessing.Process(target=listener_process, args=(queue, listener_configurer)) listener.start() workers = [] for i in range(10): worker = multiprocessing.Process(target=worker_process, args=(queue, worker_configurer)) workers.append(worker) worker.start() for w in workers: w.join() queue.put_nowait(None) listener....
multiprocessing.Process(target=listener_process, args=(queue, listener_configurer)) listener.start() workers = [] for i in range(10): worker = multiprocessing.Process(target=worker_process, args=(queue, worker_configurer)) workers.append(worker) worker.start() for w in workers: w.join() queue.put_nowait(None) listener....
python, official-docs, cpython, P0
Local_Trusted_Corpus
4a5e649f-f620-4bf7-89ca-ef4c8a6a4f92
CPython Docs
file://datasets/cpython/Doc/howto/logging-cookbook.rst
unknown
5070c1c1-62f1-4f2f-bb22-ac9ebc36a263
56,406
supabase-export-v2
6837f06427c5eb40
dummy HTTP request method, client IP address and client username """ def __init__(self, method, ip, user): self.method = method self.ip = ip self.user = user # A dummy set of requests which will be used in the simulation - we'll just pick # from this list randomly. Note that all GET requests are from 192.168.2.XXX # ...
trusted_official_docs
CPython Docs
dummy HTTP request method, client IP address and client username """ def __init__(self, method, ip, user): self.method = method self.ip = ip self.user = user # A dummy set of requests which will be used in the simulation - we'll just pick # from this list randomly. Note that all GET requests are from 192.168.2.XXX # ...
dummy HTTP request method, client IP address and client username """ def __init__(self, method, ip, user): self.method = method self.ip = ip self.user = user # A dummy set of requests which will be used in the simulation - we'll just pick # from this list randomly. Note that all GET requests are from 192.168.2.XXX # ...
python, official-docs, cpython, P0
Local_Trusted_Corpus