CKTIS / Python
logging.info
Emits an informational record for normal application progress.
Version: Python 3.14; repository image, production runtime not attested
Syntax
logging.info(msg, *args, **kwargs)Emits an informational record for normal application progress.
The default root threshold suppresses INFO. Set a suitable level and a destination to make the record visible.
INFO is level 20. An unconfigured root logger normally starts at WARNING, so the sample sets INFO explicitly. Separate arguments fill the percent placeholders when formatted. The optional extra dictionary supplies custom record fields, and reusing a reserved field such as message raises KeyError.
import io,logging
out=io.StringIO()
logging.basicConfig(stream=out,level=logging.INFO,format='%(levelno)d %(job)s %(message)s',force=True)
logging.info('rows=%d',3,extra={'job':'import'})
assert out.getvalue()=='20 import rows=3\n'
try: logging.info('x',extra={'message':'collision'})
except KeyError: pass
else: raise AssertionError
Examples
import logging
from io import StringIO
out = StringIO()
logging.basicConfig(stream=out, level=logging.INFO, format="%(levelname)s %(message)s", force=True)
logging.info("rows=%d", 3)
print(out.getvalue().strip())
Result
INFO rows=3
INFO is level 20. An unconfigured root logger normally starts at WARNING, so the sample sets INFO explicitly. Separate arguments fill the percent placeholders when formatted. The optional extra dictionary supplies custom record fields, and reusing a reserved field such as message raises KeyError.