Skip to content

Commit

Permalink
Update README for duct.main
Browse files Browse the repository at this point in the history
  • Loading branch information
weavejester committed Oct 25, 2024
1 parent 107a055 commit b50cb86
Showing 1 changed file with 23 additions and 24 deletions.
47 changes: 23 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,50 +1,49 @@
# Duct module.logging [![Build Status](https://github.com/duct-framework/module.logging/actions/workflows/test.yml/badge.svg)](https://github.com/duct-framework/logger.simple/actions/workflows/test.yml)

A [Duct][] module that adds logging to a configuration, using the
[logger.timbre][] library.
[logger.simple][] library.

This current version is experimental and will only work with the new
[duct.main][] tool. The artifact group name has been changed to prevent
accidental upgrades.

[duct]: https://github.com/duct-framework/duct
[logger.timbre]: https://github.com/duct-framework/logger.timbre
[logger.simple]: https://github.com/duct-framework/logger.simple
[duct.main]: https://github.com/duct-framework/duct.main

## Installation

To install, add the following to your project `:dependencies`:
Add the following dependency to your deps.edn file:

org.duct-framework/module.logging {:mvn/version "0.5.0"}

Or to your Leiningen project file:

[org.duct-framework/module.logging "0.5.0"]

## Usage

To add this module to your configuration, add a the
`:duct.module/logging` key to your configuration:
To add this module to your configuration, add the `:duct.module/logging`
key to your Duct configuration:

```clojure
{:duct.module/logging {}}
```

The module adds the `:duct.logger/timbre` logger to the configuration,
and sets up different appenders depending on whether the environment
is `:development` or `:production`

The environment can be set by the top-level `:duct.core/environment`
key:

```clojure
{:duct.core/environment :production}
```

Or by adding an `:environment` key to the logging module:
This module uses the Integrant [expand][] function to add the
`:duct.logger/simple` logger to the configuration. It will configured
differently depending on the active Integrant profile:

```clojure
{:duct.module/logging {:environment :development}}
```
- `:repl` - write all logs to "logs/dev.log" and `:report` level logs to
STDOUT in brief
- `:test` - write all logs to "logs/test.log"
- `:main` - write all logs in full to STDOUT

In production, the full logs are sent to `STDOUT`. In development, the
logs are sent to the `logs/dev.log` file, and in a very terse form to
`STDOUT`.
[expand]: https://github.com/weavejester/integrant#expanding

## License

Copyright © 2019 James Reeves
Copyright © 2024 James Reeves

Distributed under the Eclipse Public License either version 1.0 or (at
your option) any later version.

0 comments on commit b50cb86

Please sign in to comment.