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: Adapt to serverless@3 logging interface #174

Merged

Conversation

pgrzesik
Copy link
Contributor

@pgrzesik pgrzesik commented Dec 22, 2021

Description

Adapts to new logging API that is going to be introduced with serverless@3.

The change in scope of this plugin is fairly minor - I didn't want to change too much of the current logic, just to adapt it a bit to the new API. I'd be happy to hear about potential suggestions for improvements though 💯

Closes: #171

Checklist

  • CHANGELOG.md
  • README.md
  • Unit tests
  • Consider performance implications
  • Consider security implications

@github-actions github-actions bot added the chore Issues around the maintenance of this plugin. label Dec 22, 2021
Copy link
Owner

@neverendingqs neverendingqs left a comment

Choose a reason for hiding this comment

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

LGTM thanks!

this.v3Utils.log.warning(msg);
} else {
this.v3Utils.log.notice(msg);
}
Copy link
Owner

Choose a reason for hiding this comment

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

Doing a string search is probably fine for this PR, but I think it's best for the caller to decide between .warning() and .notice().

Was there a similar this.serverless.cli.warn() in v2?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, there wasn't a cli.warn previously and only with this new logging mechanism we've introduced proper logging levels.

I fully agree that called should be responsible for deciding the log level of the message, but on the other hand I wanted to keep the changes as small as possible. What do you think makes more sense from the perspective of the plugin here?

Copy link
Owner

Choose a reason for hiding this comment

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

I'm happy to do a refactor after merging this PR in. Thanks!

@neverendingqs
Copy link
Owner

Need to sign off, but will investigate build errors:

Run npm ci
added 61 packages in 0.696s
DOTENV: Loading environment variables from .env, .env.production:
	 - APP_MESSAGE
	 - REGION
	 - TEST_VAR
	 - STAGE
Environment: linux, node 12.22.8, framework 3.0.0-pre.3db0e613, plugin 6.0.0-pre.42186afc, SDK 4.3.0
Docs:        docs.serverless.com
Support:     forum.serverless.com

Bugs:        github.com/serverless/serverless/issues

Error:
Detected unrecognized CLI options: "--env".

1 deprecation found: run 'serverless doctor' for more details
Error: Process completed with exit code 1.

Copy link
Owner

@neverendingqs neverendingqs left a comment

Choose a reason for hiding this comment

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

@pgrzesik - is v3utils available at this time?

The docs say they should exist, but when I tried it out on neverendingqs:temp/v3utils, it wasn't defined:

$ npx serverless@pre-3 package --stage production
v3Utils exists: false
Serverless: DOTENV: Loading environment variables from .env, .env.production:
Serverless: DOTENV (WARNING): if "include" is set, "exclude" is ignored.

I would like to understand why my test is not working as expected before merging if you have a chance.

@pgrzesik
Copy link
Contributor Author

Hello @neverendingqs - thanks a lot for review, I was off for holidays but I'm back tomorrow and I'll see what might be going on in your case & in the build errors

@pgrzesik
Copy link
Contributor Author

Thanks for the review @neverendingqs - as for the build errors - they're caused by --env flag that is no longer supported in Framework v3 - this is even listed in README.md that this flag will be no longer supported.

As for your issue with v3Utils - I tried to reproduce but couldn't, for me it worked well, could you please check if you're not using some outdated version of v3 prerelease?

…-interface

# Conflicts:
#	package-lock.json
#	package.json
Copy link
Owner

@neverendingqs neverendingqs left a comment

Choose a reason for hiding this comment

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

Thanks for the review @neverendingqs - as for the build errors - they're caused by --env flag that is no longer supported in Framework v3 - this is even listed in README.md that this flag will be no longer supported.

Thanks. Sorry I realized this between the two messages, and updated the README with this information.

As for your issue with v3Utils - I tried to reproduce but couldn't, for me it worked well, could you please check if you're not using some outdated version of v3 prerelease?

That was it thanks! npx was using a local copy of serverless which was at version 2.

@neverendingqs neverendingqs merged commit d8aaff3 into neverendingqs:master Dec 30, 2021
@pgrzesik
Copy link
Contributor Author

pgrzesik commented Jan 2, 2022

Thanks a lot @neverendingqs 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Issues around the maintenance of this plugin. documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Serverless Framework v3: integrating with the new design
2 participants