(level, msg, *args)
| 31 | |
| 32 | |
| 33 | def diag(level, msg, *args): |
| 34 | # Format output message as: |
| 35 | # <tool>: <level>: msg |
| 36 | # With the `<level>:` part being colored accordingly, and the message itself in bold. |
| 37 | prefix = level_prefixes[level] |
| 38 | color = level_colors[level] |
| 39 | if args: |
| 40 | msg %= args |
| 41 | |
| 42 | # Add colors |
| 43 | prefix = colored_logger.with_bold_color(color, prefix) |
| 44 | msg = colored_logger.with_bold(msg) |
| 45 | sys.stderr.write(f'{tool_name}: {prefix}{msg}\n') |
| 46 | |
| 47 | |
| 48 | def error(msg, *args): |