diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-04-06 16:07:23 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-04-06 16:07:23 -0400 |
| commit | 6782cc5570e194791ca6cdd695b88897e9145564 (patch) | |
| tree | a428e9d954aca251212ec1cf15bd35e0badce630 /examples/log | |
| parent | 448e805293989b06e07878a4a87fdd378f7c6e02 (diff) | |
No more colons for blocks
Diffstat (limited to 'examples/log')
| -rw-r--r-- | examples/log/log.tm | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/examples/log/log.tm b/examples/log/log.tm index 7375d5f6..c6c45a21 100644 --- a/examples/log/log.tm +++ b/examples/log/log.tm @@ -5,7 +5,7 @@ timestamp_format := CString("%F %T") logfiles : @{Path} = @{/} -func _timestamp(->Text): +func _timestamp(->Text) c_str := inline C:CString { char *str = GC_MALLOC_ATOMIC(20); time_t t; time(&t); @@ -15,33 +15,33 @@ func _timestamp(->Text): } return c_str.as_text() -func info(text:Text, newline=yes): +func info(text:Text, newline=yes) say("$\[2]⚫ $text$\[]", newline) - for file in logfiles: + for file in logfiles file.append("$(_timestamp()) [info] $text$\n") -func debug(text:Text, newline=yes): +func debug(text:Text, newline=yes) say("$\[32]🟢 $text$\[]", newline) - for file in logfiles: + for file in logfiles file.append("$(_timestamp()) [debug] $text$\n") -func warn(text:Text, newline=yes): +func warn(text:Text, newline=yes) say("$\[33;1]🟡 $text$\[]", newline) - for file in logfiles: + for file in logfiles file.append("$(_timestamp()) [warn] $text$\n") -func error(text:Text, newline=yes): +func error(text:Text, newline=yes) say("$\[31;1]🔴 $text$\[]", newline) - for file in logfiles: + for file in logfiles file.append("$(_timestamp()) [error] $text$\n") -func add_logfile(file:Path): +func add_logfile(file:Path) logfiles.add(file) -func remove_logfile(file:Path): +func remove_logfile(file:Path) logfiles.remove(file) -func main(): +func main() add_logfile((./log.txt)) >> info("Hello") >> debug("Hello") |
