-
Notifications
You must be signed in to change notification settings - Fork 56
feat: upgrade logger #1265
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
Open
tckeong
wants to merge
18
commits into
source-academy:feat/upgrade-logger
Choose a base branch
from
tckeong:feat/upgrade-logger
base: feat/upgrade-logger
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat: upgrade logger #1265
tckeong
wants to merge
18
commits into
source-academy:feat/upgrade-logger
from
tckeong:feat/upgrade-logger
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Bumps [sentry](https://github.com/getsentry/sentry-elixir) from 11.0.0 to 11.0.1. - [Release notes](https://github.com/getsentry/sentry-elixir/releases) - [Changelog](https://github.com/getsentry/sentry-elixir/blob/master/CHANGELOG.md) - [Commits](getsentry/sentry-elixir@11.0.0...11.0.1) --- updated-dependencies: - dependency-name: sentry dependency-version: 11.0.1 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [phoenix_ecto](https://github.com/phoenixframework/phoenix_ecto) from 4.6.4 to 4.6.5. - [Changelog](https://github.com/phoenixframework/phoenix_ecto/blob/main/CHANGELOG.md) - [Commits](https://github.com/phoenixframework/phoenix_ecto/commits/v4.6.5) --- updated-dependencies: - dependency-name: phoenix_ecto dependency-version: 4.6.5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Add new method * Use new method * Fix credo error * Fix and update tests
* replace warn with warning "warning: the log level :warn is deprecated, use :warning instead" * empty doc "warning: module attribute @doc was set but no definition follows it" * replace '' with "" "warning: using single-quoted strings to represent charlists is deprecated." * move function "clauses with the same name and arity (number of arguments) should be grouped together" * make range explicit "10..0 has a default step of -1, please write 10..0//-1 instead" * remove alias "unused alias" * rename unused variables "warning: variable "XXX" is unused" * remove choices from validate_required """ warning: attempting to determine the presence of embed_many field :choices with validate_required/3 ... which has no effect. You can pass the :required option to Ecto.Changeset.cast_embed/3 to achieve this. """ * delete unused variables instead * Revert "remove choices from validate_required" This reverts commit 088fa96.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR upgrade the original logger, add a new logger backend (logger driver). The new logger backend, CloudWatch Logger, enabling buffered delivery of your application logs to AWS CloudWatch using
ExAws
.How It Works
Initialization
On startup, this backend reads configuration options (
:log_group
,:log_stream
,:level
,:format
,:metadata
) to set up its internal state.Buffering Logs
When the application emits a log, the
handle_event/2
callback formats it, attaches metadata, timestamps it, and buffers it.Flush Trigger
Logs are flushed in two cases:
@max_buffer_size
(immediately triggers async flush).@flush_interval
) sends a:flush_buffer
message, flushing any pending logs.AWS Auth Check
Before sending, the logger verifies that AWS credentials and region are configured via environment variables. If missing, the flush is skipped (avoiding endless retry loops).
Retry Logic
Logs are sent using
ExAws.request/1
, in%ExAws.Operation.JSON{}
format. On failure, it retries up to@max_retries
, with a delay of@retry_delay
between attempts. An error is logged on each failure.Configuration Options
Add to your
config/*.exs
:This PR integrates with Elixir’s Logger (:gen_event), offering buffered, retry-enabled delivery to AWS CloudWatch.