Skip to content

Comments

feat(logging): Add support for custom log stream name formatters#3181

Merged
cadivus merged 1 commit intomainfrom
feat/cloudwatch/custom-formatter
Jan 19, 2026
Merged

feat(logging): Add support for custom log stream name formatters#3181
cadivus merged 1 commit intomainfrom
feat/cloudwatch/custom-formatter

Conversation

@cadivus
Copy link
Member

@cadivus cadivus commented Jan 19, 2026

  • PR title and description conform to Pull Request guidelines.

Issue #, if available:

Description of changes:
This add the option to set a custom formatter for Cloudwatch logstrem names.

How did you test these changes?
Using a sample app. The formatter is set like this:

// Create custom log stream name formatter
val customFormatter = LogStreamNameFormatter { context ->
    val dateFormat = SimpleDateFormat("yyyy-MM-dd", Locale.US)
    val date = dateFormat.format(Date())
    val userId = context.userId ?: "anonymous"
    "cloudwatch-cognito-$date-${context.deviceId}-$userId"
}

// Add CloudWatch Logging plugin with custom formatter
Amplify.addPlugin(AWSCloudWatchLoggingPlugin(logStreamNameFormatter = customFormatter))

Documentation update required?

  • No
  • Yes (Please include a PR link for the documentation update)

General Checklist

  • Added Unit Tests
  • Added Integration Tests
  • Security oriented best practices and standards are followed (e.g. using input sanitization, principle of least privilege, etc)
  • Ensure commit message has the appropriate scope (e.g fix(storage): message, feat(auth): message, chore(all): message)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@cadivus cadivus requested a review from a team as a code owner January 19, 2026 14:05
@cadivus cadivus requested a review from harsh62 January 19, 2026 14:06
harsh62
harsh62 previously approved these changes Jan 19, 2026
@cadivus cadivus force-pushed the feat/cloudwatch/custom-formatter branch from 7044bad to 8c225f2 Compare January 19, 2026 14:54
@cadivus cadivus requested a review from a team as a code owner January 19, 2026 14:54
@codecov
Copy link

codecov bot commented Jan 19, 2026

Codecov Report

❌ Patch coverage is 41.17647% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 54.78%. Comparing base (232cc21) to head (8c225f2).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3181      +/-   ##
==========================================
- Coverage   54.80%   54.78%   -0.03%     
==========================================
  Files        1048     1049       +1     
  Lines       31344    31356      +12     
  Branches     4694     4695       +1     
==========================================
  Hits        17178    17178              
- Misses      12358    12370      +12     
  Partials     1808     1808              
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cadivus cadivus requested a review from harsh62 January 19, 2026 15:28
@cadivus cadivus force-pushed the feat/cloudwatch/custom-formatter branch from 8c225f2 to 882e477 Compare January 19, 2026 15:31
@cadivus cadivus enabled auto-merge (squash) January 19, 2026 16:41
@cadivus cadivus merged commit 62212b0 into main Jan 19, 2026
14 of 15 checks passed
@cadivus cadivus deleted the feat/cloudwatch/custom-formatter branch January 19, 2026 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants