Skip to content

MajAhd/elixir_logger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ElxLogger

Simple and easy way to Manage Log's with RabbitMq

Logic

  • Get Logs via rabbitMq
  • Save Logs via : file , database
  • publish log via email
  • emit logs via rabbitmq topic excgange

instalation

  • RabbitMq
  • PostgreSQL

Config

  • Postgres (config/config.exs) also read ecto documentation

  • setup your mail data (config/config.exs):

    • logs_reciver : email address that you wants recieve logs
    • relay: if you use gmail smtp.gmail.com
    • username: "[email protected]"
    • password: "YOUR PASSWORD"
  • Exchange (config/config.exs):

    • debug_exchange: "debug_logs_exchange",
    • error_exchange: "error_logs_exchange",
    • info_exchange: "info_logs_exchange",
    • trace_exchange: "trace_logs_exchange",
    • warning_exchange: "warning_logs_exchange"

Scripts

  • mix deps.get
  • iex -S mix
  • mix run test

Example

  • email an error log :
# error log : publish via  email
{:ok, connection} = AMQP.Connection.open()
{:ok, channel} = AMQP.Channel.open(connection)
topic = "error.mail"
AMQP.Exchange.topic(channel, @exchange, durable: true)
AMQP.Basic.publish(channel, @exchange, topic, @message)
AMQP.Connection.close(connection)

Manual Test (via Nodejs)

  • clone Node.Js with RabbitMQ
  • cd topics
  • node publish_topic.js "error.mail" "This Error Message will mailed"

About

Manage Application Log's with Elixir and Rabbitmq

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages