(level, text, _to_files=all)
| 123 | |
| 124 | |
| 125 | def write(level, text, _to_files=all): |
| 126 | assert level in LEVELS |
| 127 | |
| 128 | t = timestamp.current() |
| 129 | format_string = "{0}+{1:" + timestamp_format + "}: " |
| 130 | prefix = format_string.format(level[0].upper(), t) |
| 131 | |
| 132 | text = getattr(_tls, "prefix", "") + text |
| 133 | indent = "\n" + (" " * len(prefix)) |
| 134 | output = indent.join(text.split("\n")) |
| 135 | output = prefix + output + "\n\n" |
| 136 | |
| 137 | with _lock: |
| 138 | if _to_files is all: |
| 139 | _to_files = _files.values() |
| 140 | for file in _to_files: |
| 141 | file.write(level, output) |
| 142 | |
| 143 | return text |
| 144 | |
| 145 | |
| 146 | def write_format(level, format_string, *args, **kwargs): |
no test coverage detected
searching dependent graphs…