From ed50c5fefb8892ad2ba5262491669f268ddbd436 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Mon, 1 Sep 2025 16:44:58 -0400 Subject: Overhaul code to stop keeping examples and libraries in the same repo, but instead spin each out into its own repo. --- examples/log/CHANGES.md | 5 ----- examples/log/log.tm | 50 ------------------------------------------------- 2 files changed, 55 deletions(-) delete mode 100644 examples/log/CHANGES.md delete mode 100644 examples/log/log.tm (limited to 'examples/log') diff --git a/examples/log/CHANGES.md b/examples/log/CHANGES.md deleted file mode 100644 index 42ae752c..00000000 --- a/examples/log/CHANGES.md +++ /dev/null @@ -1,5 +0,0 @@ -# Version History - -## v1.0 - -Initial version diff --git a/examples/log/log.tm b/examples/log/log.tm deleted file mode 100644 index 4b7893fd..00000000 --- a/examples/log/log.tm +++ /dev/null @@ -1,50 +0,0 @@ -use -use - -timestamp_format := CString("%F %T") - -logfiles : @|Path| - -func _timestamp(->Text) - c_str := C_code:CString( - char *str = GC_MALLOC_ATOMIC(20); - time_t t; time(&t); - struct tm *tm_info = localtime(&t); - strftime(str, 20, "%F %T", tm_info); - str - ) - return c_str.as_text() - -func info(text:Text, newline=yes) - say("\[2]⚫ $text\[]", newline) - for file in logfiles - file.append("$(_timestamp()) [info] $text\n") - -func debug(text:Text, newline=yes) - say("\[32]🟢 $text\[]", newline) - for file in logfiles - file.append("$(_timestamp()) [debug] $text\n") - -func warn(text:Text, newline=yes) - say("\[33;1]🟡 $text\[]", newline) - for file in logfiles - file.append("$(_timestamp()) [warn] $text\n") - -func error(text:Text, newline=yes) - say("\[31;1]🔴 $text\[]", newline) - for file in logfiles - file.append("$(_timestamp()) [error] $text\n") - -func add_logfile(file:Path) - logfiles.add(file) - -func remove_logfile(file:Path) - logfiles.remove(file) - -func main() - add_logfile((./log.txt)) - >> info("Hello") - >> debug("Hello") - >> warn("Hello") - >> error("Hello") - -- cgit v1.2.3