-
Notifications
You must be signed in to change notification settings - Fork 22
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
feat: add new logger #161
Conversation
- 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
@@ -1,58 +1,98 @@ | |||
import { Logger } from 'tslog' |
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.
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') |
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.
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')) |
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.
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) |
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.
Why use the main logger
here rather than the reposApiLogger
?
src/utils/logger.ts
Outdated
if ( | ||
process.env.NODE_ENV === 'development' || | ||
process.env.NODE_ENV === 'test' || | ||
process.env.TEST_LOGGING === '1' | ||
) { |
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.
No need for 'error'?
Closing this PR in favor of #166. |
Pull Request
Proposed Changes
Readiness Checklist
Author/Contributor
npm run lint
and fix any linting issues that have been introducednpm run test
and run tests@jeffrey-luszcz
Reviewer
bug
,documentation
,enhancement
,infrastructure
,maintenance
, orbreaking