pyrosm.enable_logging#
- pyrosm.enable_logging(level='INFO', to_file=None, progress=True)#
Show pyrosm’s log messages, and set how every operation shows its progress.
Attaches one handler to the
pyrosmlogger, writing to stderr, or to the fileto_filewhen given, and sets the logger’s level:"INFO"(default) logs the configuration of eachOSMobject and a line per read with the number of features and the seconds it took;"DEBUG"adds the time of each phase of a read. Calling it again replaces the handler it attached before. pyrosm’s messages then no longer reach the root logger, so they are not shown twice when the application has configured logging too.- Parameters:
level (str | int) – A logging level name, such as
"INFO"or"DEBUG"(any letter case), or number.to_file (str | pathlib.Path, optional) – A file to append the messages to instead of writing them to stderr.
progress (bool | callable (default: True)) – The progress of reads, writes, crops, merges, searches for extracts, downloads and graph exports (
OSM.to_graphandpyrosm.graphs) whose ownprogressis not given:Trueshows a bar on stderr (seepyrosm.OSM),Falseshows nothing, and a callable is called asprogress(done, 100)with the percentage done, or for a download asprogress(written, total)with its bytes. Without a call to this function, progress is shown as withTrue.enable_logging("WARNING", progress=False)turns the progress off without turning on the log messages.
- Returns:
The handler attached.
- Return type:
logging.Handler