profile
viewpoint

http-kit/http-kit 2140

http-kit is a minimalist, event-driven, high-performance Clojure HTTP server/client library with WebSocket and asynchronous support

ptaoussanis/timbre 1242

Pure Clojure/Script logging library

mattetti/Weasel-Diesel 444

DSL to describe, document and test web services

mattetti/wd-sinatra 77

Weasel-Diesel Sinatra app gem, allowing you to generate/update sinatra apps using the Weasel Diesel DSL

ryfow/afterglow 2

A live-coding lighting controller, building on the Open Lighting Architecture with Clojure and bits of Overtone.

ryfow/buildr 1

Mirror of Apache Buildr

ryfow/camel 1

Mirror of Apache Camel

ryfow/camel-websocket 1

Implementation of websocket in Apache Camel

ryfow/cassandra 1

A Ruby client for the Cassandra distributed database.

ryfow/ci_reporter 1

CI::Reporter is an add-on to Test::Unit and RSpec that allows you to generate XML reports of your test and/or spec runs.

issue openedptaoussanis/timbre

Automatic initialization of logging config

One thing I've come to appreciate about the various Java logging frameworks is that they are capable of initializing themselves (generally from system properties and/or resources on the classpath) with user-provided configuration upon initial usage, when the very first message is logged. How would you feel about adding similar capability to Timbre?

I have a couple of use-cases in mind with this feature request:

  • Maintaining a logging configuration for testing/development that overrides the Timbre default configuration. For my deployed code, I can simply put a call to merge-config! first thing in my main function and use whatever mechanism I want to set my user configuration. When running code via unit tests or the REPL, though, there's not a single predictable entrypoint where I can set up my logging configuration. I've taken to setting up a development configuration in a user.clj on my project's :dev-profile classpath, but I don't find this approach entirely satisfactory.
  • When working with complex dependencies, I frequently run into the situation where dependencies are emitting log messages as part of their own initialization, in extreme cases as a side-effect of a namespace-level :require or :import. When I have to set up logging configuration via an explicit call to merge-config! it's not always possible to structure my program in a way that allows me to capture these messages as part of my own application logs; the only reliable way to capture these messages from dependencies would be to have the logging framework load my application logging config.

One possible approach would be to look for a timbre.edn resource on the classpath, which could either embed a config map for simple configurations, or for more complex configurations could be a namespaced symbol that names a var for Timbre to dereference to obtain a config map. I think the main drawback would be the slight overhead to check the initialization status on every logging call, but IMO that would be a worthwhile tradeoff.

created time in 15 hours

created repositorysyohex/bazel-mac-sample

Sample Bazel project for building macOS application in Objective-C++

created time in 19 hours

issue commenthttp-kit/http-kit

SNI support to be enabled by default?

FWIW, babashka already ships http-kit with SNI enabled by default (since its runtime is Java 11 this is not a problem). I would prefer a solution that is compatible with GraalVM. E.g.:

(defmacro with-java-8 [& body]
  (when (resolve 'javax.net.ssl.SNIHostName)
    `(do ~@body)))

and then

(with-java-8
  (def *default-client* ...))

Something like that would work.

huima

comment created time in 2 days

issue commenthttp-kit/http-kit

SNI support to be enabled by default?

I would like to revive this thread by asking if SNI can be enabled by default on runtimes that support it, as an internal library detail.

huima

comment created time in 2 days

startedmoznion/radius-rs

started time in 2 days

startedskaji/cpm

started time in 4 days

fork syohex/loopy

A looping and iteration macro.

fork in 4 days

fork syohex/apparmor-mode

Emacs major mode for editing AppArmor Policies

fork in 5 days

PR closed ptaoussanis/timbre

default-output-fn: Let :timestamp_ be optional.

E.g. timestamps are huge in the JS console, and often not very interesting there.

+2 -3

1 comment

2 changed files

lnostdal

pr closed time in 5 days

pull request commentptaoussanis/timbre

default-output-fn: Let :timestamp_ be optional.

@lnostdal Thanks Lars! Have merged manually.

lnostdal

comment created time in 5 days

issue closedptaoussanis/timbre

Possible deadlock in spit-appender

The following commit added a new locking mechanism to the spit-appender: https://github.com/ptaoussanis/timbre/commit/d53188040188e1df214d659b8716b255c9395768

This can cause a possible deadlock if you try to log something while logging something (i.e. realizing a lazy collection).

While I realize this isn't advised, it used to work but now results in a deadlock:

(timbre/info "root" (pmap #(timbre/info "num" %) (range 10)))

Note: if you fully realize the collection, there are no issues.

(timbre/info "root" (vec (pmap #(timbre/info "num" %) (range 10))))

closed time in 5 days

vincentjames501

issue commentptaoussanis/timbre

Possible deadlock in spit-appender

@vincentjames501 Thanks for the report (+ reproducible) Vincent!

vincentjames501

comment created time in 5 days

PR closed ptaoussanis/timbre

Fix #329 spit-appender deadlock

In spit-appender, force the output before acquiring a lock in case the forced code tries to acquire the same spit-appender lock from a different thread.

This is code that'll deadlock on the current production version:

(require '[taoensso.timbre :as timbre])
(require '[taoensso.timbre.appenders.core :as appenders])
(timbre/swap-config! merge {:appenders {:spit (appenders/spit-appender {:fname "/tmp/log.log"})}})
(timbre/info "root" (pmap #(timbre/info "num" %) (range 10)))
+16 -16

1 comment

1 changed file

ryfow

pr closed time in 5 days

pull request commentptaoussanis/timbre

Fix #329 spit-appender deadlock

@ryfow Thanks for the fix Ryan! Merging manually now 👍

ryfow

comment created time in 5 days

PR opened ptaoussanis/timbre

default-output-fn: Let :timestamp_ be optional.

E.g. timestamps are huge in the JS console, and often not very interesting there.

+2 -3

0 comment

2 changed files

pr created time in 5 days

issue openedptaoussanis/timbre

Possible deadlock in spit-appender

The following commit added a new locking mechanism to the spit-appender: https://github.com/ptaoussanis/timbre/commit/d53188040188e1df214d659b8716b255c9395768

This can cause a possible deadlock if you try to log something while logging something (i.e. realizing a lazy collection).

While I realize this isn't advised, it used to work but now results in a deadlock:

(timbre/info "root" (pmap #(timbre/info "num" %) (range 10)))

Note: if you fully realize the collection, there are no issues.

(timbre/info "root" (vec (pmap #(timbre/info "num" %) (range 10))))

created time in 6 days

issue commentptaoussanis/timbre

Idea: Add `set-ns-level!` function

@pjlegato Hi Paul!

You are correct that there's currently no built-in util for this. And agree that it might be nice to have one, good idea 👍

I'd recommend the following API:

(set-ns-min-level [config ?min-level] [config ns ?min-level]) ; Returns an updated config map
(set-ns-min-level! [?min-level] [ns ?min-level] [ns ?min-level]) ; Uses `alter-var-root` with `set-ns-min-level` and `*config*`.

Where

  • nil ?min-level => remove any specific entry
  • ns defaults to *ns*.

Am happy to implement this myself next time I'm working on Timbre (I expect that getting the implementation right might be somewhat non-trivial). Also happy to look at a PR if you'd like to submit one.

pjlegato

comment created time in 7 days

issue openedptaoussanis/timbre

Idea: Add `set-ns-level!` function

Adjust the log level for just one specific namespace seems to be non-trivial (unless I've missed a builtin function somehow): I currently have a single code block like:

(timbre/merge-config! {:min-level [
                                   [ #{"dev.jt.iboga.plumbing"} :info]
                                   ;;[ #{"dev.jt.iboga.plumbing"} :debug]
                                   
                                   [ #{"foo.bar"} :info]
                                   ;;[ #{"foo.bar"} :debug]
                               
                                   [#{"*"} :info]
]})

where I can toggle either dev.jt.iboga.plumbing or foo.bar between :info and :debug by commenting and uncommenting, then re-evaluating the statement.

The disadvantages of this approach are that it requires centralized logging level specification -- that is, log levels are usually not specified in the file of the namespace they affect, and it's quite verbose.

Is there any interest in a function like:

(set-ns-level! :info)

which would live locally within each source file, and auto-adjust the log level for the namespace it's being loaded into?

As I understand it, such a function would have to:

  • Inspect the current :min-level;
  • Determine whether any elements already refer to the current namespace at a different log level;
  • If so, remove that reference and add a new one for the current namespace at the new log level.

created time in 7 days

issue commentptaoussanis/timbre

Function's context in appender

Off the top of my head, can't think of any practical way of doing this - I don't suspect it'd be easy.

Basically- you'd need some way of passing a function's info to macro calls in the function body. I guess you could try mod the defn macro (or make a variation of defn) that sets up a binding of the fn name for the duration of the evaluation of the body form?

Actually, maybe that wouldn't be too difficult. Would still call it non-trivial though. And you'd need to use the custom defn macro.

viebel

comment created time in 12 days

issue commentptaoussanis/timbre

Function's context in appender

What would it take to submit a PR that passes to appender the function info?

viebel

comment created time in 12 days

issue commentptaoussanis/timbre

Function's context in appender

@viebel Hi Yehonathan, unfortunately not in what function- just what namespace.

viebel

comment created time in 12 days

issue openedptaoussanis/timbre

Function's context in appender

Is there a way - as an appender - to know in what function timbre/info has been called?

created time in 12 days

startedherumi/blog

started time in 13 days

created repositorysyohex/webapp-study

My Web Application Study

created time in 14 days

fork syohex/package-require

Emacs package manager, lighter with more features.

fork in 16 days

startedshibukawa/uuid62

started time in 19 days

issue openedptaoussanis/timbre

GraalVM native image file size.

Adding timbre to the dependency, causes the native image file to grow by approximately ~50mb.

created time in 20 days

startedmicrosoft/STL

started time in 21 days

fork syohex/emacs-monkeytype

Typing game/tutor for Emacs inspired by https://monkeytype.com

fork in 23 days

more