Skip to content

Latest commit

 

History

History
57 lines (42 loc) · 1.38 KB

README.md

File metadata and controls

57 lines (42 loc) · 1.38 KB

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: "USERNAME@DOMAIN.com"
    • 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"