{"id":13508480,"url":"https://github.com/khia/exlager","last_synced_at":"2026-01-10T17:09:36.968Z","repository":{"id":4563408,"uuid":"5704593","full_name":"khia/exlager","owner":"khia","description":"Elixir binding for lager","archived":false,"fork":false,"pushed_at":"2017-12-27T09:16:07.000Z","size":35,"stargazers_count":66,"open_issues_count":3,"forks_count":36,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-01T08:33:16.514Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/khia.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-09-06T15:45:22.000Z","updated_at":"2022-12-07T21:40:33.000Z","dependencies_parsed_at":"2022-09-24T23:50:25.493Z","dependency_job_id":null,"html_url":"https://github.com/khia/exlager","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khia%2Fexlager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khia%2Fexlager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khia%2Fexlager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khia%2Fexlager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/khia","download_url":"https://codeload.github.com/khia/exlager/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246314011,"owners_count":20757450,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T02:00:53.678Z","updated_at":"2025-03-30T11:31:55.689Z","avatar_url":"https://github.com/khia.png","language":"Elixir","funding_links":[],"categories":["Logging"],"sub_categories":[],"readme":"ExLager\n=======\n\nThis package implements a simple wrapper over https://github.com/basho/lager.\n\nIt embeds logging calls to ExLager into a module if currently configured logging\nlevel is less or equal than severity of a call. Therefore it doesn't have\nany negative impact on performance of a production system when you configure\nerror level even if you have tons of debug messages.\n\nInformation about location of a call (module, function, line, pid) is properly\npassed to lager for your convenience so you can easily find the source of a message.\nIn this aspect using ExLager is equal to using parse transform shipped with\nbasho lager.\n\nSince ExLager depends on macro implemented in Lager module you have to require it.\nThen you call one of logging methods on Lager module. There are seven logging\nmethods in order of severity:\n\n - debug\n - info\n - notice\n - warning\n - error\n - critical\n - alert\n - emergency\n\nExamples:\n---------\n\n```elixir\ndefmodule Test do\n  require Lager\n  def debug do\n    Lager.debug \"Hi debug\"\n  end\n  def info do\n    Lager.info \"Hi error\"\n  end\n  def notice do\n    Lager.notice \"Hi notice\"\n  end\n  def warning do\n    Lager.warning \"Hi warning\"\n  end\n  def error do\n    Lager.error \"Hi error\"\n  end\n  def critical do\n    Lager.critical \"Hi critical\"\n  end\n  def alert do\n    Lager.alert \"Hi alert\"\n  end\n  def emergency do\n    Lager.emergency \"Hi emergency\"\n  end\n  def test do\n    debug\n    info\n    notice\n    warning\n    error\n    critical\n    alert\n    emergency\n  end\nend\n\nApplication.start :exlager\nTest.test\n```\n\nConfiguration\n-------------\nIt is possible to configure truncation size and compile time log level.\nBeing a simple wrapper ExLager doesn't attempt to configure underlying Lager.\nYou would need to configure it yourself [see](https://github.com/basho/lager) to ensure that:\n\n  * lager_truncation_size \u003e= compile_truncation_size\n  * lager severity level \u003e= compile_log_level\n  * appropriate handlers are configured\n\nConfiguration of ExLager can be done by calling helper functions of Lager from your build system as follows:\n\n```\niex(1)\u003e Lager.compile_log_level(:info)\ntrue\niex(2)\u003e Lager.compile_truncation_size(512)\ntrue\n```\n\nIf you cannot call those function you can set compiler options:\n\n```\niex(3)\u003e Code.compiler_options exlager_level: :debug\nok\niex(4)\u003e Code.compiler_options exlager_truncation_size: 512\nok\n```\n\nIf you are mix user you could specify level and truncation_size in *config/config.#{Mix.env}.exs* as follows:\n\n```\n    use Mix.Config\n\n    config :exlager,\n      level: :debug,\n      truncation_size: 8096\n```\n\nMultiple Sink Support\n---------------------\nAs of Lager 3.x, you can configure multiple sinks to provide different behavior\nfor different streams of logs.  To use a different sink, prepend the name to the\nlogging calls above.  For example, to use the `magic_lager_event` sink, you can\ndo the following:\n\n```\nLager.info :magic, \"magic event\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkhia%2Fexlager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkhia%2Fexlager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkhia%2Fexlager/lists"}