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

feat: improve ama-sdk plugins logging #1184

Merged
merged 1 commit into from
Jan 12, 2024

Conversation

sdo-1A
Copy link
Contributor

@sdo-1A sdo-1A commented Jan 4, 2024

Proposed change

Possibility to connect a third-party logger in ama-sdk, fallback to console logger if undefined.

Related issues

apps/showcase/src/app/app.module.ts Outdated Show resolved Hide resolved
@@ -63,7 +63,7 @@ export class ApiAngularClient implements ApiClient {
let opts = options;
if (this.options.requestPlugins) {
for (const plugin of this.options.requestPlugins) {
opts = await plugin.load().transform(opts);
opts = await plugin.load({logger: this.options.logger}).transform(opts);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could be simplified to

Suggested change
opts = await plugin.load({logger: this.options.logger}).transform(opts);
opts = await plugin.load(this.options).transform(opts);

packages/@ama-sdk/core/src/logger/index.ts Outdated Show resolved Hide resolved
packages/@ama-sdk/core/src/logger/logger.ts Outdated Show resolved Hide resolved
packages/@ama-sdk/core/src/plugins/core/fetch-plugin.ts Outdated Show resolved Hide resolved
@sdo-1A sdo-1A force-pushed the feat/ama-sdk-plugins-logging branch from 780e12c to 5118e9f Compare January 4, 2024 16:43
@sdo-1A sdo-1A force-pushed the feat/ama-sdk-plugins-logging branch from 5118e9f to 636b177 Compare January 5, 2024 09:36
@sdo-1A sdo-1A force-pushed the feat/ama-sdk-plugins-logging branch from 636b177 to 537c8e3 Compare January 5, 2024 13:18
@sdo-1A sdo-1A force-pushed the feat/ama-sdk-plugins-logging branch from 537c8e3 to ad25371 Compare January 5, 2024 15:41
@sdo-1A sdo-1A force-pushed the feat/ama-sdk-plugins-logging branch from ad25371 to 252c8ee Compare January 5, 2024 16:34
@@ -76,6 +77,9 @@
"@angular/common": {
"optional": true
},
"@o3r/core": {
"optional": true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it really optional ?
regardless, @o3r/core should also be added in the devDependencies generated by the @ama-sdk/schematics:typescript-shell https://github.com/AmadeusITGroup/otter/blob/release/10.0.0-next/packages/%40ama-sdk/schematics/schematics/typescript/shell/templates/base/package.json.template#L79

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is optional since it is only used to import types (Logger from @o3r/core)

@sdo-1A sdo-1A force-pushed the feat/ama-sdk-plugins-logging branch from ecec776 to 686ac66 Compare January 11, 2024 16:45
* @param message Message to log
* @param optionalParams Optional parameters to log
*/
error(message?: any, ...optionalParams: any[]): void;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it could be valuable to have the this: Logger as first param to avoid le context loosing usage

@sdo-1A sdo-1A force-pushed the feat/ama-sdk-plugins-logging branch from 686ac66 to dfdcdb2 Compare January 12, 2024 09:41
@sdo-1A sdo-1A merged commit 0cab03b into release/10.0.0-next Jan 12, 2024
18 checks passed
@sdo-1A sdo-1A deleted the feat/ama-sdk-plugins-logging branch January 12, 2024 09:56
vscaiceanu-1a added a commit that referenced this pull request May 2, 2024
## Proposed change

Cherry-pick of #1184 on 9.6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants