Giter Site home page Giter Site logo

nlog.targets.redis's Introduction

Build status NuGet

NLog.Targets.Redis

This project provides a custom target for the NLog framework to allow a user to send log messages to a Redis server. The target supports sending log messages to a Redis list or to a pub/sub channel.

Installation

NLog.Targets.Redis is available as a NuGet Package. Type the following command into the Nuget Package Manager Console window to install it:

Install-Package NLog.Targets.Redis

Usage

The <target /> configuration section contains five required fields and one optional field.

  • host (required): The host name or IP Address of the Redis server.
  • port (required): The port the Redis server is listening on, defaults to 6379.
  • key (required): The key that should be used to identify the Redis list or the pub/sub channel to which the log messages are being delivered.
  • dataType (optional): The Redis data type that should be used to store the log messages. This can be either list or channel, defaults to list.
  • channelPattern (optional): The Redis Channel Pattern to use when dataType = channel. This can be either literal or pattern, defaults to auto.
  • layout (required): The layout that defines the format of the message to be sent to the Redis target.
  • db (optional): The Redis database id to store the log messages in, if the Redis database type list is chosen.
  • clientName (optional): The Client name to use for all Redis connections.
  • configurationOptions (optional): Additional configuration options (comma delimited). See Configuration Options

Config File

<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" throwExceptions="true">
  <extensions>
    <add assembly="NLog.Targets.Redis" />
  </extensions>
  <targets>
    <target xsi:type="Redis" name="redis" host="127.0.0.1" port="6379" db="0" 
            key="logKey" dataType="list" 
            layout="${longdate} ${level:uppercase=true} ${message} ${exception:format=tostring}" />
  </targets>
  <rules>
    <logger name="*" minlevel="Info" writeTo="redis" />
  </rules>
</nlog>

Notes

This is a fork of https://github.com/richclement/NLog.Redis

Admin

How to release

  1. Create a new release with a new tag
  2. Wait for the build

nlog.targets.redis's People

Contributors

304notmodified avatar gamingrobot avatar richclement avatar roh85 avatar silvenga avatar snakefoot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nlog.targets.redis's Issues

Add unit tests

The current unit tests are integration tests so they need Redis running.

That isn't really needed.

  1. Make RedisTarget mockable
  2. Create mock that writes into memory
  3. Inject mocks in unit tests
  4. Copy tests, keep needed, and change to unit test

Strong name code

Like all NLog libs, with the same key

fix assembly version to 1.0.0.0?

rename repo to NLog.Targets.Redis?

Maybe we should rename this repo to NLog.Targets.Redis

That's more transparant I think.

(note: github will create a redirect for NLog.redis then)

Consider Embedding the SE.Redis Library

We should consider embedding the Redis library into the assembly - functionally this will reduce the API surface area. This would be similar to how Hangfire inlines the same package into Hangfire.Pro.Redis (sorry, only example I could think of).

Nuget/Project Name

We need a name to publish Nuget packages under, suggestions:

We might be able to petition Microsoft/Nuget to get contributor access to NLog.Redis.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.