ffclj link and logger example (#839 and #806) (#924)

* add ffclj to libraries list

* add simple logger macro to examples

* add a missing link on projects page
This commit is contained in:
Bob 2021-07-08 14:18:01 -04:00 committed by GitHub
parent 39e17f149b
commit 5430fee1fd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 0 deletions

View file

@ -43,6 +43,7 @@ The following libraries and projects are known to work with babashka.
- [slingshot](#slingshot) - [slingshot](#slingshot)
- [hasch](#hasch) - [hasch](#hasch)
- [crispin](#crispin) - [crispin](#crispin)
- [ffclj](#ffclj)
- [Pods](#pods) - [Pods](#pods)
- [Projects](#projects-1) - [Projects](#projects-1)
- [babashka-test-action](#babashka-test-action) - [babashka-test-action](#babashka-test-action)
@ -628,6 +629,10 @@ FOO=1 script.clj
"1" "1"
``` ```
### [ffclj](https://github.com/luissantos/ffclj)
A wrapper around executing `ffmpeg` and `ffprobe`. Supports progress reporting via core.async channels.
## Pods ## Pods
[Babashka pods](https://github.com/babashka/babashka.pods) are programs that can [Babashka pods](https://github.com/babashka/babashka.pods) are programs that can

View file

@ -35,6 +35,7 @@
- [normalize-keywords.clj](#normalize-keywordsclj) - [normalize-keywords.clj](#normalize-keywordsclj)
- [Check stdin for data](#check-stdin-for-data) - [Check stdin for data](#check-stdin-for-data)
- [Using org.clojure/data.xml](#using-orgclojuredataxml) - [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! 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 $ bb examples/xml-example.clj
... some vaguely interesting XML manipulation output ... 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\")"
<expr>:1:19 the logger says hi
```

11
examples/logger.clj Normal file
View file

@ -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))))