https://github.com/semperos/log4clj
Thin Clojure wrapper over log4j
https://github.com/semperos/log4clj
Last synced: about 1 year ago
JSON representation
Thin Clojure wrapper over log4j
- Host: GitHub
- URL: https://github.com/semperos/log4clj
- Owner: semperos
- Created: 2011-12-16T19:04:28.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2011-12-16T19:43:06.000Z (over 14 years ago)
- Last Synced: 2025-01-15T23:31:59.704Z (over 1 year ago)
- Language: Clojure
- Homepage:
- Size: 93.8 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Log4clj: Log4j DSL in Clojure
DSL is probably too gracious a term. Right now, this is just a thin layer of Clojure to allow configuring log4j loggers programmatically. The all-in-one entry-point is the `config-logger` function. Reading the source code is highly recommended.
I've built this to abstract out a custom appender that I wrote in Clojure to output log4j logs to a Swing app. For that reason, this library also comes with a SwingAppender class.
## Usage
### Bare-bones ###
```clj
(use 'com.semperos.log4clj.core)
(config-logger)
```
This sets up the root logger with a default `ConsoleAppender` with a level of `DEBUG`. For now, look at the source code to see what else I've exposed as Clojure functions.
### Adding Appenders ###
```clj
(config-logger {:appenders[ (default-swing-appender "swingy" my-swing-component)
(default-console-appender "consoley") ]})
```
This sets up the root logger with two appenders. The appenders both have custom names, so you can interact with them via the logger. The `my-swing-component` parameter should be something like a `JTextArea` where you intend the log data to be appended.
### Low-Level API ###
For now, read the source code in the core namespace to see what lower-level functions are available.
## License
Copyright (C) 2011 Daniel L. Gregoire (semperos)
Distributed under the Eclipse Public License, the same as Clojure.