mirror of
https://github.com/StuffAnThings/qbit_manage.git
synced 2025-10-25 05:27:33 +08:00
Ignore empty newlines in multiline print
This commit is contained in:
parent
e1033547cc
commit
1b916809fa
1 changed files with 4 additions and 2 deletions
|
|
@ -18,8 +18,10 @@ spacing = 0
|
|||
|
||||
|
||||
def print_multiline(lines, loglevel='INFO'):
|
||||
for i, line in enumerate(str(lines).split("\n")):
|
||||
logger.log(getattr(logging, loglevel),line)
|
||||
line_list = str(lines).split("\n")
|
||||
for i, line in enumerate(line_list):
|
||||
if len(line) > 0 and i != len(line_list)-1:
|
||||
logger.log(getattr(logging, loglevel),line)
|
||||
if i == 0:
|
||||
logger.handlers[1].setFormatter(logging.Formatter(" " * 37 + "| %(message)s"))
|
||||
logger.handlers[1].setFormatter(logging.Formatter("[%(asctime)s] %(levelname)-10s | %(message)s"))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue