Sha256: 570ff94be0278fbb3b8cd98e73785ef729b519b88c8dd91823ca2f18ea8b587b

Contents?: true

Size: 1.14 KB

Versions: 2

Compression:

Stored size: 1.14 KB

Contents

# SlackLogDevice

LogDevice implementation that post logs on a Slack channel.

## Setup

Just add this into your `Gemfile`:

```ruby
gem 'slack_log_device'
```

Then, just run a `bundle install`.

## Usage

```ruby
require 'slack_log_device'

logger = Logger.new(SlackLogDevice.new(webhook_url: 'https://hooks.slack.com/services/...', username: 'MyApp'))
logger.level = Logger::INFO
logger.warn('BAM!')
```

Then, the logged message will be writen to webhook's configured channel.

Note that the messages written are buffered in order to avoid consecutive
request.

## Options

- `auto_flush`: To flush messages directly when a message is written (disabled
by default).
- `flush_delay`: The delay in seconds to flush messages (1 by default).
- `max_buffer_size`: The max buffer size to flush messages (8192 by default).
- `timeout`: The timeout in seconds to send message to slack (5 by default).
- `username`: The username to post message as (nil by default).
- `webhook_url`: The URL of the webhook (mandatory).

## Executing test suite

This project is fully tested with [Rspec 3](http://github.com/rspec/rspec).
Just run `bundle exec rake` (after a `bundle install`).

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
slack_log_device-2.0.1 README.mdown
slack_log_device-2.0.0 README.mdown