Fork me on GitHub
#babashka
<
2021-12-25
>
DrLjótsson23:12:12

Hey. I’m new to Babashka. I have successfully installed it on my Raspberry Pi and managed to run basic scripts. Now I want logging and I haven’t figured out how to log to a file.

borkdude09:12:00

@UGDTSFM4M Welcome! taoensso.timbre is a built-in dependency so you shouldn't have to include the dep. But we didn't expose the appenders namespace in babashka. spit-appender is also available in the taoensso.timbre namespace

🙏 1
DrLjótsson09:12:04

Thanks x 2! I see, I'll try that when I'm at the computer.

DrLjótsson23:12:22

(ns my-project.log
  (:require [taoensso.timbre :as timbre]
            [taoensso.timbre.appenders.core :as appenders]))

(timbre/merge-config!
  {:appenders {:spit (appenders/spit-appender {:fname "/path/my-file.log"})}})

DrLjótsson23:12:51

bb.edn contains

DrLjótsson23:12:56

:deps  {
         com.taoensso/timbre {:mvn/version "5.1.2"}}

DrLjótsson23:12:28

I get the following error

DrLjótsson23:12:15

> ----- Error -------------------------------------------------------------------- > Type:   clojure.lang.ExceptionInfo > Message: Could not resolve symbol: clojure-version > Location: clojure/tools/reader/impl/utils.clj:17:35 > Phase:  analysis > > ----- Context ------------------------------------------------------------------ > 13:  (when x > 14:   (clojure.core/char x))) > 15:  > 16: (def <=clojure-1-7-alpha5 > 17:  (let [{:keys [minor qualifier]} clojure-version] >                    ^--- Could not resolve symbol: clojure-version > 18:   (or (< minor 7) > 19:     (and (= minor 7) > 20:       (= “alpha” > 21:         (when qualifier > 22:          (subs qualifier 0 (dec (count qualifier)))))