diff --git a/doc/projects.md b/doc/projects.md index 2a337adb..512d3e48 100644 --- a/doc/projects.md +++ b/doc/projects.md @@ -43,6 +43,7 @@ The following libraries and projects are known to work with babashka. - [slingshot](#slingshot) - [hasch](#hasch) - [crispin](#crispin) + - [ffclj](#ffclj) - [Pods](#pods) - [Projects](#projects-1) - [babashka-test-action](#babashka-test-action) @@ -628,6 +629,10 @@ FOO=1 script.clj "1" ``` +### [ffclj](https://github.com/luissantos/ffclj) + +A wrapper around executing `ffmpeg` and `ffprobe`. Supports progress reporting via core.async channels. + ## Pods [Babashka pods](https://github.com/babashka/babashka.pods) are programs that can diff --git a/examples/README.md b/examples/README.md index 7c958753..e02d648a 100644 --- a/examples/README.md +++ b/examples/README.md @@ -35,6 +35,7 @@ - [normalize-keywords.clj](#normalize-keywordsclj) - [Check stdin for data](#check-stdin-for-data) - [Using org.clojure/data.xml](#using-orgclojuredataxml) + - [Simple logger](#simple-logger) Here's a gallery of useful examples. Do you have a useful example? PR welcome! @@ -512,3 +513,12 @@ in use. $ bb examples/xml-example.clj ... some vaguely interesting XML manipulation output ``` + +## Simple logger + +[logger.clj](logger.clj) is a simple logger that works in bb. + +``` clojure +$ bb "(require 'logger) (logger/log \"the logger says hi\")" +:1:19 the logger says hi +``` diff --git a/examples/logger.clj b/examples/logger.clj new file mode 100644 index 00000000..bc2c48ad --- /dev/null +++ b/examples/logger.clj @@ -0,0 +1,11 @@ +(ns logger) + +(defmacro log [& msgs] + (let [m (meta &form) + _ns (ns-name *ns*) ;; can also be used for logging + file *file*] + `(binding [*out* *err*] ;; or bind to (io/writer log-file) + (println (str ~file ":" + ~(:line m) ":" + ~(:column m)) + ~@msgs))))