archivebox.misc.logging_utilο
Module Contentsο
Classesο
mutable stats counter for logging archiving timing info to CLI output |
|
Show a progress bar and measure elapsed time until .end() is called |
Functionsο
show timer in the form of progress bar, with percentage and seconds remaining |
|
quote the argument with whitespace in a command so the user can copy-paste the outputted string directly to run the cmd |
|
convert paths like β¦/ArchiveBox/archivebox/../output/abc into output/abc |
|
Format duration in human-readable form. |
|
Truncate URL to max_length, keeping domain and adding ellipsis. |
|
Log a worker event with structured metadata and indentation. |
|
Dataο
APIο
- class archivebox.misc.logging_util.RuntimeStats[source]ο
mutable stats counter for logging archiving timing info to CLI output
- class archivebox.misc.logging_util.TimedProgress(seconds, prefix='')[source]ο
Show a progress bar and measure elapsed time until .end() is called
Initialization
- archivebox.misc.logging_util.progress_bar(seconds: int, prefix: str = '', ANSI: dict[str, str] = ANSI) None[source]ο
show timer in the form of progress bar, with percentage and seconds remaining
- archivebox.misc.logging_util.log_cli_command(subcommand: str, subcommand_args: collections.abc.Iterable[str] = (), stdin: str | IO | None = None, pwd: str = '.')[source]ο
- archivebox.misc.logging_util.log_importing_started(urls: str | list[str], depth: int, index_only: bool)[source]ο
- archivebox.misc.logging_util.log_archiving_started(num_links: int, resume: float | None = None)[source]ο
- archivebox.misc.logging_util.log_archiving_paused(num_links: int, idx: int, timestamp: str)[source]ο
- archivebox.misc.logging_util.log_snapshot_archiving_started(snapshot: archivebox.core.models.Snapshot, out_dir: str, is_new: bool)[source]ο
- archivebox.misc.logging_util.log_snapshot_archiving_finished(snapshot: archivebox.core.models.Snapshot, out_dir: str, is_new: bool, stats: dict, start_ts: datetime.datetime)[source]ο
- archivebox.misc.logging_util.log_archive_method_finished(result: dict)[source]ο
quote the argument with whitespace in a command so the user can copy-paste the outputted string directly to run the cmd
- archivebox.misc.logging_util.log_list_started(filter_patterns: list[str] | None, filter_type: str)[source]ο
- archivebox.misc.logging_util.log_removal_finished(remaining_links: int, removed_links: int)[source]ο
- archivebox.misc.logging_util.pretty_path(path: pathlib.Path | str, pwd: pathlib.Path | str = DATA_DIR, color: bool = True) str[source]ο
convert paths like β¦/ArchiveBox/archivebox/../output/abc into output/abc
- archivebox.misc.logging_util.format_duration(seconds: float) str[source]ο
Format duration in human-readable form.
- archivebox.misc.logging_util.truncate_url(url: str, max_length: int = 60) str[source]ο
Truncate URL to max_length, keeping domain and adding ellipsis.
- archivebox.misc.logging_util.log_worker_event(worker_type: str, event: str, indent_level: int = 0, pid: int | None = None, worker_id: str | None = None, url: str | None = None, plugin: str | None = None, metadata: dict[str, Any] | None = None, error: Exception | None = None) None[source]ο
Log a worker event with structured metadata and indentation.
Args: worker_type: Type of worker (Orchestrator, CrawlWorker, SnapshotWorker) event: Event name (Starting, Completed, Failed, etc.) indent_level: Indentation level (0=Orchestrator, 1=CrawlWorker, 2=SnapshotWorker) pid: Process ID worker_id: Worker ID (UUID for workers) url: URL being processed (for SnapshotWorker) plugin: Plugin name (for hook processes) metadata: Dict of metadata to show in curly braces error: Exception if event is an error
- archivebox.misc.logging_util.printable_folders(folders: dict[str, Optional[archivebox.core.models.Snapshot]], with_headers: bool = False) str[source]ο