Skip to content

Commit

Permalink
watch: add --log-nospace
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamilcuk committed Oct 7, 2024
1 parent 1fdaa1d commit 9b054f6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/nomad_tools/entry_watch.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,11 @@ def print_all_threads_stacktrace(*_):
out = "\n".join(x for x in "\n".join(text).splitlines() if x)
eprint("\n\n" + out + "\n\n")


def datetime_is_naive(d: datetime.datetime) -> bool:
return d.tzinfo is None or d.tzinfo.utcoffset(d) is None


###############################################################################


Expand Down Expand Up @@ -273,6 +275,7 @@ class LogFormatter:
mark = "{{log.mark}}>"
post = "{{log.message}}{{log.colorreset}}"
task = "{{log.task + '>' if log.task}}"
space = "{{' ' if not args.log_nospace}}"

DEFAULT = (
pre
Expand All @@ -288,7 +291,7 @@ class LogFormatter:
O>45fbbd>v0>task1> hello world
"""

ONE = pre + mark + task + " " + post
ONE = pre + mark + task + space + post
"""
Log format with -1 option.
O>task1> hello world
Expand Down Expand Up @@ -398,6 +401,7 @@ class LogOptions:
"-0", aliased=dict(log_format=LogFormatter.ZERO)
)
log_json: bool = clickdc.alias_option(aliased=dict(log_format=LogFormatter.JSON))
log_nospace: bool = clickdc.option(help="Do not print space on log lines")
out: List[str] = clickdc.option(
"-o",
type=CommaList("all alloc stdout stderr eval deploy nolog none".split()),
Expand Down

0 comments on commit 9b054f6

Please sign in to comment.