Git Product home page Git Product logo

ex_logdna's Introduction

CircleCI status badge

Elixir logger backend for LogDNA

A logger backend for elixir to send application logs to LogDNA through their ingestion API.

Installation

The package can be installed by adding ex_logdna to your list of dependencies in mix.exs:

def deps do
  [
    {:ex_logdna, "~> 0.1.0"}
  ]
end

Configuration

First configure your logger to use the LogDNA backend. It also respects the level and metadata configuration.

config :logger, backends: [LogDNA], level: :info, metadata: [:request_id, :event, :tags]

Then configure the backend with some LogDNA specific configurations.

config :ex_logdna,
  ingestion_key: System.get_env("LOGDNA_INGESTION_KEY"),
  app: "my-app",
  hostname: "localhost",
  tags: ["web", "prod"]

Find more information in the LogDNA ingestion API documentation.

Usage

After configuring your application to use the LogDNA backend, just use logger as you normally would. To send a log entry with log level info for instance:

Logger.info("Logging stuff to LogDNA")

The backend has support for metadata, just pass it on as the second argument:

Logger.info("Logging stuff to LogDNA with additional metadata.", user_id: "some-user-id")

๐Ÿช„ Magic metadata

Some metadata properties are reserved for magic.

Tags

If you pass in tags with your log entry, it won't be sent in as metadata, but as native LogDNA tags.

Logger.info("Logging stuff to LogDNA with additional metadata.", tags: ["one", "two"])

Should you have configured global tags in your config file, these event tags will be merged into the global tags, and they are all passed along to the ingestion API.

ex_logdna's People

Contributors

robfalken avatar

Watchers

 avatar

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.