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

fix: logging of first octokit instance is not set #1676

Merged
merged 1 commit into from Jun 1, 2022

Conversation

kammerjaeger
Copy link
Contributor

This should fix the logging in the default ocotkit instance from issue #1673

@markjm
Copy link

markjm commented May 23, 2022

Ran into the same issue! below is my suggested patch which will re-utilize the approach to binding the logger already present

diff --git a/src/octokit/get-probot-octokit-with-defaults.ts b/src/octokit/get-probot-octokit-with-defaults.ts
index 16d190b..08373bf 100644
--- a/src/octokit/get-probot-octokit-with-defaults.ts
+++ b/src/octokit/get-probot-octokit-with-defaults.ts
@@ -3,6 +3,7 @@ import { ProbotOctokit } from "./probot-octokit";
 import Redis from "ioredis";
 
 import { getOctokitThrottleOptions } from "./get-octokit-throttle-options";
+import { aliasLog } from "../helpers/alias-log";
 
 import type { Logger } from "pino";
 
@@ -45,6 +46,9 @@ export function getProbotOctokitWithDefaults(options: Options) {
 
   let defaultOptions: any = {
     auth: authOptions,
+    log: options.log.child
+      ? aliasLog(options.log.child({ name: "octokit" }))
+      : options.log,
   };
 
   if (options.baseUrl) {

@gr2m
Copy link
Contributor

gr2m commented May 23, 2022

@kammerjaeger can you update your PR based on @markjm suggestion?

@kammerjaeger
Copy link
Contributor Author

Thanks, I did not see the helper. I changed it to the proposed code.
The file get-authenticated-octokit.ts uses the same method that I used before to set the logger. Should that also be changed (in a different PR)?

@markjm
Copy link

markjm commented Jun 1, 2022

looks like we are ready to go on this? @gr2m

Copy link
Contributor

@gr2m gr2m left a comment

Choose a reason for hiding this comment

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

Thank you both!

@gr2m gr2m merged commit 646b6a9 into probot:master Jun 1, 2022
@github-actions
Copy link

github-actions bot commented Jun 1, 2022

🎉 This PR is included in version 12.2.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants