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: add new logger #161

Closed
wants to merge 7 commits into from
Closed

feat: add new logger #161

wants to merge 7 commits into from

Conversation

sutterj
Copy link
Contributor

@sutterj sutterj commented Jun 11, 2024

Pull Request

Proposed Changes

  • Closes Replace logger with logger that supports json #129
    • Add winston logger
    • Use winston logger with custom format for dev/test and prod
    • Add custom redactor
    • Reviewed existing log calls for standardization
    • Remove logger from front end components
    • Edit some log messages for clarity
    • Add error stack to logging

Readiness Checklist

Author/Contributor

  • If documentation is needed for this change, has that been included in this pull request
  • run npm run lint and fix any linting issues that have been introduced
  • run npm run test and run tests
  • If publishing new data to the public (scorecards, security scan results, code quality results, live dashboards, etc.), please request review from @jeffrey-luszcz

Reviewer

  • Label as either bug, documentation, enhancement, infrastructure, maintenance, or breaking

sutterj added 6 commits June 10, 2024 22:09
- use winston logger with custom format for dev/test and prod
- add custom redactor
- reviewed existing log calls for standardization
- remove logger from front end components
@sutterj sutterj added the enhancement New feature or request label Jun 11, 2024
@sutterj sutterj requested a review from a team as a code owner June 11, 2024 17:55
@@ -1,58 +1,98 @@
import { Logger } from 'tslog'
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we are replacing tslog, does it need to be removed from the package.json or is it a builtin library?

@@ -38,24 +38,34 @@ export const createAllPushProtection = async (
'all-branch-protections-icf',
['~ALL'],
)

rulesLogger.info('Branch protection created')
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd be interested to hear the logic behind when you use info level versus debug.

@@ -23,7 +23,7 @@ export const checkInstallationHandler = async ({

return { installed: false }
} catch (error) {
octokitApiLogger.info('Failed to check installation', { input, error })
octokitApiLogger.info(new Error('Failed to check installation'))
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
octokitApiLogger.info(new Error('Failed to check installation'))
octokitApiLogger.info(new Error('Failed to check app installation'))

@@ -59,7 +59,7 @@ export const createMirrorHandler = async ({
}

if (!(e as Error).message.includes('Not Found')) {
logger.error({ error: e })
logger.error(e)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why use the main logger here rather than the reposApiLogger?

Comment on lines 20 to 24
if (
process.env.NODE_ENV === 'development' ||
process.env.NODE_ENV === 'test' ||
process.env.TEST_LOGGING === '1'
) {
Copy link
Contributor

Choose a reason for hiding this comment

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

No need for 'error'?

@sutterj sutterj closed this Jun 12, 2024
@sutterj
Copy link
Contributor Author

sutterj commented Jun 12, 2024

Closing this PR in favor of #166.

@sutterj sutterj deleted the sutterj/replace-logger branch June 12, 2024 00:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace logger with logger that supports json
2 participants