logging_util.py 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615
  1. __package__ = 'archivebox'
  2. import re
  3. import os
  4. import sys
  5. import stat
  6. import time
  7. import argparse
  8. from math import log
  9. from multiprocessing import Process
  10. from pathlib import Path
  11. from datetime import datetime
  12. from dataclasses import dataclass
  13. from typing import Any, Optional, List, Dict, Union, IO, TYPE_CHECKING
  14. if TYPE_CHECKING:
  15. from .index.schema import Link, ArchiveResult
  16. from .util import enforce_types
  17. from .config import (
  18. ConfigDict,
  19. OUTPUT_DIR,
  20. PYTHON_ENCODING,
  21. VERSION,
  22. ANSI,
  23. IS_TTY,
  24. IN_DOCKER,
  25. TERM_WIDTH,
  26. SHOW_PROGRESS,
  27. SOURCES_DIR_NAME,
  28. stderr,
  29. )
  30. @dataclass
  31. class RuntimeStats:
  32. """mutable stats counter for logging archiving timing info to CLI output"""
  33. skipped: int = 0
  34. succeeded: int = 0
  35. failed: int = 0
  36. parse_start_ts: Optional[datetime] = None
  37. parse_end_ts: Optional[datetime] = None
  38. index_start_ts: Optional[datetime] = None
  39. index_end_ts: Optional[datetime] = None
  40. archiving_start_ts: Optional[datetime] = None
  41. archiving_end_ts: Optional[datetime] = None
  42. # globals are bad, mmkay
  43. _LAST_RUN_STATS = RuntimeStats()
  44. def debug_dict_summary(obj: Dict[Any, Any]) -> None:
  45. stderr(' '.join(f'{key}={str(val).ljust(6)}' for key, val in obj.items()))
  46. def get_fd_info(fd) -> Dict[str, Any]:
  47. NAME = fd.name[1:-1]
  48. FILENO = fd.fileno()
  49. MODE = os.fstat(FILENO).st_mode
  50. IS_TTY = hasattr(fd, 'isatty') and fd.isatty()
  51. IS_PIPE = stat.S_ISFIFO(MODE)
  52. IS_FILE = stat.S_ISREG(MODE)
  53. IS_TERMINAL = not (IS_PIPE or IS_FILE)
  54. IS_LINE_BUFFERED = fd.line_buffering
  55. IS_READABLE = fd.readable()
  56. return {key: val for key, val in locals().items() if val is not fd}
  57. # # Log debug information about stdin, stdout, and stderr
  58. # sys.stdout.write('[>&1] this is python stdout\n')
  59. # sys.stderr.write('[>&2] this is python stderr\n')
  60. # debug_dict_summary(get_fd_info(sys.stdin))
  61. # debug_dict_summary(get_fd_info(sys.stdout))
  62. # debug_dict_summary(get_fd_info(sys.stderr))
  63. class SmartFormatter(argparse.HelpFormatter):
  64. """Patched formatter that prints newlines in argparse help strings"""
  65. def _split_lines(self, text, width):
  66. if '\n' in text:
  67. return text.splitlines()
  68. return argparse.HelpFormatter._split_lines(self, text, width)
  69. def reject_stdin(caller: str, stdin: Optional[IO]=sys.stdin) -> None:
  70. """Tell the user they passed stdin to a command that doesn't accept it"""
  71. if not stdin:
  72. return None
  73. if IN_DOCKER:
  74. # when TTY is disabled in docker we cant tell if stdin is being piped in or not
  75. # if we try to read stdin when its not piped we will hang indefinitely waiting for it
  76. return None
  77. if not stdin.isatty():
  78. # stderr('READING STDIN TO REJECT...')
  79. stdin_raw_text = stdin.read()
  80. if stdin_raw_text:
  81. # stderr('GOT STDIN!', len(stdin_str))
  82. stderr(f'[X] The "{caller}" command does not accept stdin.', color='red')
  83. stderr(f' Run archivebox "{caller} --help" to see usage and examples.')
  84. stderr()
  85. raise SystemExit(1)
  86. return None
  87. def accept_stdin(stdin: Optional[IO]=sys.stdin) -> Optional[str]:
  88. """accept any standard input and return it as a string or None"""
  89. if not stdin:
  90. return None
  91. if not stdin.isatty():
  92. # stderr('READING STDIN TO ACCEPT...')
  93. stdin_str = stdin.read()
  94. if stdin_str:
  95. # stderr('GOT STDIN...', len(stdin_str))
  96. return stdin_str
  97. return None
  98. class TimedProgress:
  99. """Show a progress bar and measure elapsed time until .end() is called"""
  100. def __init__(self, seconds, prefix=''):
  101. self.SHOW_PROGRESS = SHOW_PROGRESS
  102. if self.SHOW_PROGRESS:
  103. self.p = Process(target=progress_bar, args=(seconds, prefix))
  104. self.p.start()
  105. self.stats = {'start_ts': datetime.now(), 'end_ts': None}
  106. def end(self):
  107. """immediately end progress, clear the progressbar line, and save end_ts"""
  108. end_ts = datetime.now()
  109. self.stats['end_ts'] = end_ts
  110. if self.SHOW_PROGRESS:
  111. # terminate if we havent already terminated
  112. try:
  113. # kill the progress bar subprocess
  114. try:
  115. self.p.close() # must be closed *before* its terminnated
  116. except:
  117. pass
  118. self.p.terminate()
  119. self.p.join()
  120. # clear whole terminal line
  121. try:
  122. sys.stdout.write('\r{}{}\r'.format((' ' * TERM_WIDTH()), ANSI['reset']))
  123. except (IOError, BrokenPipeError):
  124. # ignore when the parent proc has stopped listening to our stdout
  125. pass
  126. except ValueError:
  127. pass
  128. @enforce_types
  129. def progress_bar(seconds: int, prefix: str='') -> None:
  130. """show timer in the form of progress bar, with percentage and seconds remaining"""
  131. chunk = '█' if PYTHON_ENCODING == 'UTF-8' else '#'
  132. last_width = TERM_WIDTH()
  133. chunks = last_width - len(prefix) - 20 # number of progress chunks to show (aka max bar width)
  134. try:
  135. for s in range(seconds * chunks):
  136. max_width = TERM_WIDTH()
  137. if max_width < last_width:
  138. # when the terminal size is shrunk, we have to write a newline
  139. # otherwise the progress bar will keep wrapping incorrectly
  140. sys.stdout.write('\r\n')
  141. sys.stdout.flush()
  142. chunks = max_width - len(prefix) - 20
  143. pct_complete = s / chunks / seconds * 100
  144. log_pct = (log(pct_complete or 1, 10) / 2) * 100 # everyone likes faster progress bars ;)
  145. bar_width = round(log_pct/(100/chunks))
  146. last_width = max_width
  147. # ████████████████████ 0.9% (1/60sec)
  148. sys.stdout.write('\r{0}{1}{2}{3} {4}% ({5}/{6}sec)'.format(
  149. prefix,
  150. ANSI['green' if pct_complete < 80 else 'lightyellow'],
  151. (chunk * bar_width).ljust(chunks),
  152. ANSI['reset'],
  153. round(pct_complete, 1),
  154. round(s/chunks),
  155. seconds,
  156. ))
  157. sys.stdout.flush()
  158. time.sleep(1 / chunks)
  159. # ██████████████████████████████████ 100.0% (60/60sec)
  160. sys.stdout.write('\r{0}{1}{2}{3} {4}% ({5}/{6}sec)'.format(
  161. prefix,
  162. ANSI['red'],
  163. chunk * chunks,
  164. ANSI['reset'],
  165. 100.0,
  166. seconds,
  167. seconds,
  168. ))
  169. sys.stdout.flush()
  170. # uncomment to have it disappear when it hits 100% instead of staying full red:
  171. # time.sleep(0.5)
  172. # sys.stdout.write('\r{}{}\r'.format((' ' * TERM_WIDTH()), ANSI['reset']))
  173. # sys.stdout.flush()
  174. except (KeyboardInterrupt, BrokenPipeError):
  175. print()
  176. pass
  177. def log_cli_command(subcommand: str, subcommand_args: List[str], stdin: Optional[str], pwd: str):
  178. cmd = ' '.join(('archivebox', subcommand, *subcommand_args))
  179. stderr('{black}[i] [{now}] ArchiveBox v{VERSION}: {cmd}{reset}'.format(
  180. now=datetime.now().strftime('%Y-%m-%d %H:%M:%S'),
  181. VERSION=VERSION,
  182. cmd=cmd,
  183. **ANSI,
  184. ))
  185. stderr('{black} > {pwd}{reset}'.format(pwd=pwd, **ANSI))
  186. stderr()
  187. ### Parsing Stage
  188. def log_importing_started(urls: Union[str, List[str]], depth: int, index_only: bool):
  189. _LAST_RUN_STATS.parse_start_ts = datetime.now()
  190. print('{green}[+] [{}] Adding {} links to index (crawl depth={}){}...{reset}'.format(
  191. _LAST_RUN_STATS.parse_start_ts.strftime('%Y-%m-%d %H:%M:%S'),
  192. len(urls) if isinstance(urls, list) else len(urls.split('\n')),
  193. depth,
  194. ' (index only)' if index_only else '',
  195. **ANSI,
  196. ))
  197. def log_source_saved(source_file: str):
  198. print(' > Saved verbatim input to {}/{}'.format(SOURCES_DIR_NAME, source_file.rsplit('/', 1)[-1]))
  199. def log_parsing_finished(num_parsed: int, parser_name: str):
  200. _LAST_RUN_STATS.parse_end_ts = datetime.now()
  201. print(' > Parsed {} URLs from input ({})'.format(num_parsed, parser_name))
  202. def log_deduping_finished(num_new_links: int):
  203. print(' > Found {} new URLs not already in index'.format(num_new_links))
  204. def log_crawl_started(new_links):
  205. print()
  206. print('{green}[*] Starting crawl of {} sites 1 hop out from starting point{reset}'.format(len(new_links), **ANSI))
  207. ### Indexing Stage
  208. def log_indexing_process_started(num_links: int):
  209. start_ts = datetime.now()
  210. _LAST_RUN_STATS.index_start_ts = start_ts
  211. print()
  212. print('{black}[*] [{}] Writing {} links to main index...{reset}'.format(
  213. start_ts.strftime('%Y-%m-%d %H:%M:%S'),
  214. num_links,
  215. **ANSI,
  216. ))
  217. def log_indexing_process_finished():
  218. end_ts = datetime.now()
  219. _LAST_RUN_STATS.index_end_ts = end_ts
  220. def log_indexing_started(out_path: str):
  221. if IS_TTY:
  222. sys.stdout.write(f' > {out_path}')
  223. def log_indexing_finished(out_path: str):
  224. print(f'\r √ {out_path}')
  225. ### Archiving Stage
  226. def log_archiving_started(num_links: int, resume: Optional[float]=None):
  227. start_ts = datetime.now()
  228. _LAST_RUN_STATS.archiving_start_ts = start_ts
  229. print()
  230. if resume:
  231. print('{green}[▶] [{}] Resuming archive updating for {} pages starting from {}...{reset}'.format(
  232. start_ts.strftime('%Y-%m-%d %H:%M:%S'),
  233. num_links,
  234. resume,
  235. **ANSI,
  236. ))
  237. else:
  238. print('{green}[▶] [{}] Starting archiving of {} snapshots in index...{reset}'.format(
  239. start_ts.strftime('%Y-%m-%d %H:%M:%S'),
  240. num_links,
  241. **ANSI,
  242. ))
  243. def log_archiving_paused(num_links: int, idx: int, timestamp: str):
  244. end_ts = datetime.now()
  245. _LAST_RUN_STATS.archiving_end_ts = end_ts
  246. print()
  247. print('\n{lightyellow}[X] [{now}] Downloading paused on link {timestamp} ({idx}/{total}){reset}'.format(
  248. **ANSI,
  249. now=end_ts.strftime('%Y-%m-%d %H:%M:%S'),
  250. idx=idx+1,
  251. timestamp=timestamp,
  252. total=num_links,
  253. ))
  254. print()
  255. print(' {lightred}Hint:{reset} To view your archive index, run:'.format(**ANSI))
  256. print(' archivebox server # then visit http://127.0.0.1:8000')
  257. print(' Continue archiving where you left off by running:')
  258. print(' archivebox update --resume={}'.format(timestamp))
  259. def log_archiving_finished(num_links: int):
  260. end_ts = datetime.now()
  261. _LAST_RUN_STATS.archiving_end_ts = end_ts
  262. assert _LAST_RUN_STATS.archiving_start_ts is not None
  263. seconds = end_ts.timestamp() - _LAST_RUN_STATS.archiving_start_ts.timestamp()
  264. if seconds > 60:
  265. duration = '{0:.2f} min'.format(seconds / 60)
  266. else:
  267. duration = '{0:.2f} sec'.format(seconds)
  268. print()
  269. print('{}[√] [{}] Update of {} pages complete ({}){}'.format(
  270. ANSI['green'],
  271. end_ts.strftime('%Y-%m-%d %H:%M:%S'),
  272. num_links,
  273. duration,
  274. ANSI['reset'],
  275. ))
  276. print(' - {} links skipped'.format(_LAST_RUN_STATS.skipped))
  277. print(' - {} links updated'.format(_LAST_RUN_STATS.succeeded + _LAST_RUN_STATS.failed))
  278. print(' - {} links had errors'.format(_LAST_RUN_STATS.failed))
  279. print()
  280. print(' {lightred}Hint:{reset} To manage your archive in a Web UI, run:'.format(**ANSI))
  281. print(' archivebox server 0.0.0.0:8000')
  282. def log_link_archiving_started(link: "Link", link_dir: str, is_new: bool):
  283. # [*] [2019-03-22 13:46:45] "Log Structured Merge Trees - ben stopford"
  284. # http://www.benstopford.com/2015/02/14/log-structured-merge-trees/
  285. # > output/archive/1478739709
  286. print('\n[{symbol_color}{symbol}{reset}] [{symbol_color}{now}{reset}] "{title}"'.format(
  287. symbol_color=ANSI['green' if is_new else 'black'],
  288. symbol='+' if is_new else '√',
  289. now=datetime.now().strftime('%Y-%m-%d %H:%M:%S'),
  290. title=link.title or link.base_url,
  291. **ANSI,
  292. ))
  293. print(' {blue}{url}{reset}'.format(url=link.url, **ANSI))
  294. print(' {} {}'.format(
  295. '>' if is_new else '√',
  296. pretty_path(link_dir),
  297. ))
  298. def log_link_archiving_finished(link: "Link", link_dir: str, is_new: bool, stats: dict):
  299. total = sum(stats.values())
  300. if stats['failed'] > 0 :
  301. _LAST_RUN_STATS.failed += 1
  302. elif stats['skipped'] == total:
  303. _LAST_RUN_STATS.skipped += 1
  304. else:
  305. _LAST_RUN_STATS.succeeded += 1
  306. def log_archive_method_started(method: str):
  307. print(' > {}'.format(method))
  308. def log_archive_method_finished(result: "ArchiveResult"):
  309. """quote the argument with whitespace in a command so the user can
  310. copy-paste the outputted string directly to run the cmd
  311. """
  312. # Prettify CMD string and make it safe to copy-paste by quoting arguments
  313. quoted_cmd = ' '.join(
  314. '"{}"'.format(arg) if ' ' in arg else arg
  315. for arg in result.cmd
  316. )
  317. if result.status == 'failed':
  318. if result.output.__class__.__name__ == 'TimeoutExpired':
  319. duration = (result.end_ts - result.start_ts).seconds
  320. hint_header = [
  321. '{lightyellow}Extractor timed out after {}s.{reset}'.format(duration, **ANSI),
  322. ]
  323. else:
  324. hint_header = [
  325. '{lightyellow}Extractor failed:{reset}'.format(**ANSI),
  326. ' {reset}{} {red}{}{reset}'.format(
  327. result.output.__class__.__name__.replace('ArchiveError', ''),
  328. result.output,
  329. **ANSI,
  330. ),
  331. ]
  332. # Prettify error output hints string and limit to five lines
  333. hints = getattr(result.output, 'hints', None) or ()
  334. if hints:
  335. hints = hints if isinstance(hints, (list, tuple)) else hints.split('\n')
  336. hints = (
  337. ' {}{}{}'.format(ANSI['lightyellow'], line.strip(), ANSI['reset'])
  338. for line in hints[:5] if line.strip()
  339. )
  340. # Collect and prefix output lines with indentation
  341. output_lines = [
  342. *hint_header,
  343. *hints,
  344. '{}Run to see full output:{}'.format(ANSI['lightred'], ANSI['reset']),
  345. *([' cd {};'.format(result.pwd)] if result.pwd else []),
  346. ' {}'.format(quoted_cmd),
  347. ]
  348. print('\n'.join(
  349. ' {}'.format(line)
  350. for line in output_lines
  351. if line
  352. ))
  353. print()
  354. def log_list_started(filter_patterns: Optional[List[str]], filter_type: str):
  355. print('{green}[*] Finding links in the archive index matching these {} patterns:{reset}'.format(
  356. filter_type,
  357. **ANSI,
  358. ))
  359. print(' {}'.format(' '.join(filter_patterns or ())))
  360. def log_list_finished(links):
  361. from .index.csv import links_to_csv
  362. print()
  363. print('---------------------------------------------------------------------------------------------------')
  364. print(links_to_csv(links, cols=['timestamp', 'is_archived', 'num_outputs', 'url'], header=True, ljust=16, separator=' | '))
  365. print('---------------------------------------------------------------------------------------------------')
  366. print()
  367. def log_removal_started(links: List["Link"], yes: bool, delete: bool):
  368. print('{lightyellow}[i] Found {} matching URLs to remove.{reset}'.format(len(links), **ANSI))
  369. if delete:
  370. file_counts = [link.num_outputs for link in links if Path(link.link_dir).exists()]
  371. print(
  372. f' {len(links)} Links will be de-listed from the main index, and their archived content folders will be deleted from disk.\n'
  373. f' ({len(file_counts)} data folders with {sum(file_counts)} archived files will be deleted!)'
  374. )
  375. else:
  376. print(
  377. ' Matching links will be de-listed from the main index, but their archived content folders will remain in place on disk.\n'
  378. ' (Pass --delete if you also want to permanently delete the data folders)'
  379. )
  380. if not yes:
  381. print()
  382. print('{lightyellow}[?] Do you want to proceed with removing these {} links?{reset}'.format(len(links), **ANSI))
  383. try:
  384. assert input(' y/[n]: ').lower() == 'y'
  385. except (KeyboardInterrupt, EOFError, AssertionError):
  386. raise SystemExit(0)
  387. def log_removal_finished(all_links: int, to_remove: int):
  388. if all_links == 0:
  389. print()
  390. print('{red}[X] No matching links found.{reset}'.format(**ANSI))
  391. else:
  392. print()
  393. print('{red}[√] Removed {} out of {} links from the archive index.{reset}'.format(
  394. to_remove,
  395. all_links,
  396. **ANSI,
  397. ))
  398. print(' Index now contains {} links.'.format(all_links - to_remove))
  399. def log_shell_welcome_msg():
  400. from .cli import list_subcommands
  401. print('{green}# ArchiveBox Imports{reset}'.format(**ANSI))
  402. print('{green}from core.models import Snapshot, User{reset}'.format(**ANSI))
  403. print('{green}from archivebox import *\n {}{reset}'.format("\n ".join(list_subcommands().keys()), **ANSI))
  404. print()
  405. print('[i] Welcome to the ArchiveBox Shell!')
  406. print(' https://github.com/ArchiveBox/ArchiveBox/wiki/Usage#Shell-Usage')
  407. print()
  408. print(' {lightred}Hint:{reset} Example use:'.format(**ANSI))
  409. print(' print(Snapshot.objects.filter(is_archived=True).count())')
  410. print(' Snapshot.objects.get(url="https://example.com").as_json()')
  411. print(' add("https://example.com/some/new/url")')
  412. ### Helpers
  413. @enforce_types
  414. def pretty_path(path: Union[Path, str]) -> str:
  415. """convert paths like .../ArchiveBox/archivebox/../output/abc into output/abc"""
  416. pwd = Path('.').resolve()
  417. # parent = os.path.abspath(os.path.join(pwd, os.path.pardir))
  418. return str(path).replace(str(pwd) + '/', './')
  419. @enforce_types
  420. def printable_filesize(num_bytes: Union[int, float]) -> str:
  421. for count in ['Bytes','KB','MB','GB']:
  422. if num_bytes > -1024.0 and num_bytes < 1024.0:
  423. return '%3.1f %s' % (num_bytes, count)
  424. num_bytes /= 1024.0
  425. return '%3.1f %s' % (num_bytes, 'TB')
  426. @enforce_types
  427. def printable_folders(folders: Dict[str, Optional["Link"]],
  428. with_headers: bool=False) -> str:
  429. return '\n'.join(
  430. f'{folder} {link and link.url} "{link and link.title}"'
  431. for folder, link in folders.items()
  432. )
  433. @enforce_types
  434. def printable_config(config: ConfigDict, prefix: str='') -> str:
  435. return f'\n{prefix}'.join(
  436. f'{key}={val}'
  437. for key, val in config.items()
  438. if not (isinstance(val, dict) or callable(val))
  439. )
  440. @enforce_types
  441. def printable_folder_status(name: str, folder: Dict) -> str:
  442. if folder['enabled']:
  443. if folder['is_valid']:
  444. color, symbol, note = 'green', '√', 'valid'
  445. else:
  446. color, symbol, note, num_files = 'red', 'X', 'invalid', '?'
  447. else:
  448. color, symbol, note, num_files = 'lightyellow', '-', 'disabled', '-'
  449. if folder['path']:
  450. if Path(folder['path']).exists():
  451. num_files = (
  452. f'{len(os.listdir(folder["path"]))} files'
  453. if Path(folder['path']).is_dir() else
  454. printable_filesize(Path(folder['path']).stat().st_size)
  455. )
  456. else:
  457. num_files = 'missing'
  458. path = str(folder['path']).replace(str(OUTPUT_DIR), '.') if folder['path'] else ''
  459. if path and ' ' in path:
  460. path = f'"{path}"'
  461. # if path is just a plain dot, replace it back with the full path for clarity
  462. if path == '.':
  463. path = str(OUTPUT_DIR)
  464. return ' '.join((
  465. ANSI[color],
  466. symbol,
  467. ANSI['reset'],
  468. name.ljust(21),
  469. num_files.ljust(14),
  470. ANSI[color],
  471. note.ljust(8),
  472. ANSI['reset'],
  473. path.ljust(76),
  474. ))
  475. @enforce_types
  476. def printable_dependency_version(name: str, dependency: Dict) -> str:
  477. version = None
  478. if dependency['enabled']:
  479. if dependency['is_valid']:
  480. color, symbol, note, version = 'green', '√', 'valid', ''
  481. parsed_version_num = re.search(r'[\d\.]+', dependency['version'])
  482. if parsed_version_num:
  483. version = f'v{parsed_version_num[0]}'
  484. if not version:
  485. color, symbol, note, version = 'red', 'X', 'invalid', '?'
  486. else:
  487. color, symbol, note, version = 'lightyellow', '-', 'disabled', '-'
  488. path = str(dependency["path"]).replace(str(OUTPUT_DIR), '.') if dependency["path"] else ''
  489. if path and ' ' in path:
  490. path = f'"{path}"'
  491. return ' '.join((
  492. ANSI[color],
  493. symbol,
  494. ANSI['reset'],
  495. name.ljust(21),
  496. version.ljust(14),
  497. ANSI[color],
  498. note.ljust(8),
  499. ANSI['reset'],
  500. path.ljust(76),
  501. ))