-
Notifications
You must be signed in to change notification settings - Fork 247
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
feat(logging): default remote config #3643
Merged
khatruong2009
merged 28 commits into
feat/logging/cloudwatch
from
feat/logging/default-remote-config
Sep 20, 2023
Merged
Changes from 24 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
5ad91cf
feat(logging): add cloudwatch logger plugin
53ef002
feat(logging): default remote config
khatruong2009 0506c77
chore: dart FileStorage refactor and unit tests added
khatruong2009 f379e7c
chore: made the Future.delayed more explicit
khatruong2009 8de0309
chore: added flutter path provider to amplify_logging_cloudwatch
khatruong2009 55dfab9
chore: removed fluter dependency
khatruong2009 0ef2b3d
chore: remove flutter plugin files from git ignore now that flutter d…
khatruong2009 53c66a3
chore: changed names of file storage functions, logger level, and rem…
khatruong2009 507d086
chore: remove flutter plugin .gitignore
khatruong2009 bc635d8
chore: Added completer, removed conditional import, added closeable, …
khatruong2009 1e3c6ae
chore: updated aft workflows
khatruong2009 6c03448
Update packages/logging_cloudwatch/aws_logging_cloudwatch/lib/src/plu…
khatruong2009 03a8455
Update packages/logging_cloudwatch/aws_logging_cloudwatch/lib/src/plu…
khatruong2009 05391d8
chore: removed manual toJson and replace jsonSerializable with zAmpli…
khatruong2009 009b0d8
Update packages/logging_cloudwatch/aws_logging_cloudwatch/lib/src/fil…
khatruong2009 9ecffbf
Update packages/logging_cloudwatch/aws_logging_cloudwatch/lib/src/fil…
khatruong2009 8750486
chore: use factory constructor and _fileStorage might be null in remo…
khatruong2009 f513d0e
chore: fixed local storage variable and method name and also added an…
khatruong2009 c12af97
Update packages/logging_cloudwatch/aws_logging_cloudwatch/lib/src/rem…
khatruong2009 2cbb9b7
Update packages/logging_cloudwatch/aws_logging_cloudwatch/lib/src/rem…
khatruong2009 cad71d6
Update packages/logging_cloudwatch/aws_logging_cloudwatch/lib/src/rem…
khatruong2009 5f185c4
Update packages/logging_cloudwatch/aws_logging_cloudwatch/lib/src/rem…
khatruong2009 b77c8ae
chore: add AWSSerializable and added comment to test to address Futur…
khatruong2009 da94fe3
chore: fixed some formatting and removed todo comment
khatruong2009 0f3bae3
chore: removed unnecessary comments
khatruong2009 04b78d4
Update packages/logging_cloudwatch/aws_logging_cloudwatch/test/remote…
khatruong2009 0cba479
Update packages/logging_cloudwatch/aws_logging_cloudwatch/test/remote…
khatruong2009 3c2b666
Update packages/logging_cloudwatch/aws_logging_cloudwatch/lib/src/fil…
khatruong2009 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
...ng_cloudwatch/amplify_logging_cloudwatch/lib/src/path_provider/flutter_path_provider.dart
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import 'package:amplify_core/amplify_core.dart'; | ||
import 'package:path_provider/path_provider.dart'; | ||
|
||
/// {@template flutter_path_provider} | ||
/// A [AppPathProvider] that uses the [path_provider](https://pub.dev/packages/path_provider) | ||
/// package to get the application support and temporary paths. | ||
/// {@endtemplate} | ||
class FlutterPathProvider implements AppPathProvider { | ||
@override | ||
Future<String> getApplicationSupportPath() async { | ||
final directory = await getApplicationSupportDirectory(); | ||
return directory.path; | ||
} | ||
|
||
@override | ||
Future<String> getTemporaryPath() async { | ||
final directory = await getTemporaryDirectory(); | ||
return directory.path; | ||
} | ||
} |
This file contains 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
19 changes: 19 additions & 0 deletions
19
packages/logging_cloudwatch/aws_logging_cloudwatch/lib/src/file_storage/file_storage.dart
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import 'package:amplify_core/amplify_core.dart'; | ||
import 'package:aws_logging_cloudwatch/src/file_storage/file_storage_stub.dart' | ||
if (dart.library.io) 'file_storage_vm.dart' | ||
if (dart.library.html) 'file_storage_web.dart'; | ||
|
||
/// File storage interface for saving and loading constraint locally | ||
abstract interface class FileStorage { | ||
/// Default Constructor or FileStorage | ||
factory FileStorage(AppPathProvider pathProvider) = FileStorageImpl; | ||
|
||
/// Save constraint locally to file | ||
Future<void> save(String fileName, String data); | ||
|
||
/// Load constraint from file | ||
Future<String?> load(String filename); | ||
khatruong2009 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} |
24 changes: 24 additions & 0 deletions
24
...ges/logging_cloudwatch/aws_logging_cloudwatch/lib/src/file_storage/file_storage_stub.dart
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import 'package:amplify_core/amplify_core.dart'; | ||
import 'package:aws_logging_cloudwatch/src/file_storage/file_storage.dart'; | ||
|
||
/// File storage implementation for saving and loading constraint locally | ||
class FileStorageImpl implements FileStorage { | ||
/// File storage implementation for saving and loading constraint locally | ||
FileStorageImpl(this.pathProvider); | ||
|
||
/// Path provider to get the application support path | ||
final AppPathProvider pathProvider; | ||
|
||
@override | ||
Future<String?> load(String fileName) async { | ||
throw UnimplementedError(); | ||
} | ||
|
||
@override | ||
Future<void> save(String fileName, String content) async { | ||
throw UnimplementedError(); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
packages/logging_cloudwatch/aws_logging_cloudwatch/lib/src/file_storage/file_storage_vm.dart
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import 'dart:io'; | ||
|
||
import 'package:amplify_core/amplify_core.dart'; | ||
import 'package:aws_logging_cloudwatch/src/file_storage/file_storage.dart'; | ||
import 'package:path/path.dart' as p; | ||
|
||
/// File storage implementation for saving and loading constraint locally | ||
class FileStorageImpl implements FileStorage { | ||
/// File storage implementation for saving and loading constraint locally | ||
FileStorageImpl(this.pathProvider); | ||
|
||
/// Path provider to get the application support path | ||
final AppPathProvider pathProvider; | ||
|
||
@override | ||
Future<String?> load(String fileName) async { | ||
final file = | ||
File(p.join(await pathProvider.getApplicationSupportPath(), fileName)); | ||
if (await file.exists()) { | ||
return file.readAsString(); | ||
} | ||
return null; | ||
} | ||
|
||
@override | ||
Future<void> save(String fileName, String content) async { | ||
final file = | ||
File(p.join(await pathProvider.getApplicationSupportPath(), fileName)); | ||
await file.writeAsString(content); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...ages/logging_cloudwatch/aws_logging_cloudwatch/lib/src/file_storage/file_storage_web.dart
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import 'dart:html'; | ||
|
||
import 'package:amplify_core/amplify_core.dart'; | ||
import 'package:aws_logging_cloudwatch/src/file_storage/file_storage.dart'; | ||
|
||
/// File storage implementation for saving and loading constraint locally | ||
class FileStorageImpl implements FileStorage { | ||
/// File storage implementation for saving and loading constraint locally | ||
// ignore: avoid_unused_constructor_parameters | ||
FileStorageImpl(AppPathProvider pathProvider); | ||
|
||
static const _prefix = 'aws.cloudwatch'; | ||
khatruong2009 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
@override | ||
Future<String?> load(String fileName) async { | ||
return window.localStorage['$_prefix.$fileName']; | ||
} | ||
|
||
@override | ||
Future<void> save(String fileName, String content) async { | ||
window.localStorage['$_prefix.$fileName'] = content; | ||
} | ||
} |
This file contains 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
76 changes: 76 additions & 0 deletions
76
packages/logging_cloudwatch/aws_logging_cloudwatch/lib/src/plugin_config.g.dart
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: not sure what this change is for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bump^