GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - polyfox/loxe: Logfmt based logger for Elixir.

BranchesTags
Open more actions menu

Latest commit

 

History

9 Commits
9 Commits

Folders and files

NameName
Last commit message
Last commit date
benchmarks
benchmarks
 
 
config
config
 
 
lib/loxe
lib/loxe
 
 
test
test
 
 
.gitignore
.gitignore
 
 
CHANGELOG.md
CHANGELOG.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
mix.exs
mix.exs
 
 
mix.lock
mix.lock
 
 

Repository files navigation

Loxe

Loxe is logfmt logger interface, it is built atop Elixir's standard Logger module.

Config

As of version 0.4.0, you can configure loxe to filter metadata:

config :loxe,
  # By default, if a value cannot be encoded by logfmt, it would normally raise a Protocol.UndefinedError
  # This field can be set to handle those cases differently:
  # * `:raise` the default
  # * `:placeholder` will replace the value with <protocol-unavailable>
  # * `:inspect` will use inspect instead of Logfmt.ValueEncoder if it is not available
  on_protocol_undefined: :raise,
  metadata: [
    only: [
      # keys that should always be included from the metadata
      :just_this,
      :and_this,
      :maybe_this,
    ],
    except: [
      # keys that should always be excluded from the metadata
      :not_this,
      :and_not_this,
    ],
  ]

Keep in mind this is a compile-time configuration therefore changing the above during runtime will have no effect.

Note The presence of loxe.metadata.only (even if just an empty list) changes the filtering behaviour completely. If present, every key from Logger.metadata/0 will be rejected by default except those specified in the list.

Note The presence of loxe.metadata.except has the default behaviour in which all keys are allowed by default (unless loxe.metadata.only is present in which case the default is to reject), except the keys listed.

Note This only affects fields from Logger.metadata/0, if you specified the list using Loxe's log functions, it will be present in the log line:

Loxe.Logger.metadata not_this: "something", and_not_this: "something-else"

Loxe.Logger.info "hi"
# => msg=hi
Loxe.Logger.info "hi", not_this: "should exist"
# => not_this="should exist" msg=hi

Usage

use Loxe.Logger

Loxe.Logger.info "message"
# => msg="message"

Loxe.Logger.info "message", [a: "Egg", b: "Rice"]
# => a="Egg" b="Rice" msg="message"

Installation

def deps do
  [
    {:loxe, git: "https://github.com/polyfox/loxe"}
  ]
end

About

Logfmt based logger for Elixir.

Topics

elixirelixir-langloggerlogging

Resources

Readme
MIT license
Activity
Custom properties

Stars

0 stars

Watchers

2 watching

Forks

1 fork
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.