Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update code to support latest elixir #25

Merged
merged 3 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
otp: [22.x, 23.x, 24.x]
elixir: [1.10.x, 1.11.x]
otp: ['24.3.4.17', '25.3.2.12', '26.2.5']
elixir: ['1.15.8', '1.16.3']
steps:
- uses: actions/checkout@v2
- name: Set up Elixir
uses: erlef/setup-elixir@885971a72ed1f9240973bd92ab57af8c1aa68f24
uses: erlef/setup-beam@v1
with:
otp-version: ${{matrix.otp}}
elixir-version: ${{matrix.elixir}}
Expand Down
4 changes: 2 additions & 2 deletions config/config.exs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is responsible for configuring your application
# and its dependencies with the aid of the Mix.Config module.
use Mix.Config
import Config

# This configuration is loaded before any dependency and is restricted
# to this project. If another project depends on this project, this
Expand All @@ -22,6 +22,6 @@ use Mix.Config
# here (which is why it is important to import them last).
#

import_config "#{Mix.env}.exs"
import_config "#{config_env()}.exs"


4 changes: 2 additions & 2 deletions config/dev.exs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use Mix.Config
import Config

config :logger,
utc_log: true,
truncate: 8192,
sync_threshold: 40,
discard_threshold_for_error_logger: 500,
compile_time_purge_level: :debug,
compile_time_purge_matching: [[level_lower_than: :debug]],
backends: [
{ExSyslogger, :ex_syslogger_error},
{ExSyslogger, :ex_syslogger_debug},
Expand Down
2 changes: 1 addition & 1 deletion config/prod.exs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
use Mix.Config
import Config
8 changes: 4 additions & 4 deletions config/test.exs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use Mix.Config
import Config

config :logger,
utc_log: true,
truncate: 8192,
sync_threshold: 40,
discard_threshold_for_error_logger: 500,
compile_time_purge_level: :debug,
compile_time_purge_matching: [[level_lower_than: :debug]],
backends: [
{ExSyslogger, :ex_syslogger_error},
{ExSyslogger, :ex_syslogger_debug},
Expand All @@ -14,12 +14,12 @@ config :logger,

config :logger, :console,
level: :error,
format: "$date $time [$level] $levelpad$node $metadata $message\n",
format: "$date $time [$level] $node $metadata $message\n",
metadata: [:module, :line, :function]

config :logger, :ex_syslogger_error,
level: :error,
format: "$date $time [$level] $levelpad$node $metadata $message",
format: "$date $time [$level] $node $metadata $message",
metadata: [:module, :line, :function],
ident: "MyApplication Error",
facility: :local0,
Expand Down
2 changes: 1 addition & 1 deletion examples/example1/config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ config :logger,
truncate: 8192,
sync_threshold: 40,
discard_threshold_for_error_logger: 500,
compile_time_purge_level: :debug,
compile_time_purge_matching: [[level_lower_than: :debug]],
backends: [
:console,
{ExSyslogger, :ex_syslogger_error},
Expand Down
11 changes: 6 additions & 5 deletions test/exsyslog_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@ defmodule ExsyslogTest do
use ExUnit.Case

require Logger

test "different level of logs" do
debug_log = "debug log #{random_str()}"
Logger.debug debug_log
Logger.debug(debug_log)

info_log = "info log #{random_str()}"
Logger.info info_log
Logger.info(info_log)

error_log = "error log #{random_str()}"
Logger.error error_log
Logger.error(error_log)
end

def random_str do
18
|> :crypto.strong_rand_bytes
|> Base.encode16
|> :crypto.strong_rand_bytes()
|> Base.encode16()
end
end
Loading