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

Logger console output #57

Open
whilefoo opened this issue Feb 2, 2025 · 9 comments · May be fixed by #58
Open

Logger console output #57

whilefoo opened this issue Feb 2, 2025 · 9 comments · May be fixed by #58

Comments

@whilefoo
Copy link
Member

whilefoo commented Feb 2, 2025

    console.warn
         Could not get user role

      81 |     return { role, limit };
      82 |   } catch (err) {
    > 83 |     logger.error("Could not get user role", { err });
         |            ^
      84 |     return { role: "unknown", limit: maxConcurrentTasks.contributor };
      85 |   }
      86 | }

      at PrettyLogs._log (node_modules/@ubiquity-os/ubiquity-os-logger/dist/index.js:149:7)
      at PrettyLogs._logWithStack (node_modules/@ubiquity-os/ubiquity-os-logger/dist/index.js:69:10)
      at PrettyLogs.error (node_modules/@ubiquity-os/ubiquity-os-logger/dist/index.js:51:10)
      at _Logs._log (node_modules/@ubiquity-os/ubiquity-os-logger/dist/index.js:174:7)
      at _Logs.error (node_modules/@ubiquity-os/ubiquity-os-logger/dist/index.js:234:17)
      at error (src/handlers/shared/get-user-task-limit-and-role.ts:83:12)
      at getUserRoleAndTaskLimit (src/handlers/shared/start.ts:76:33)
      at start (src/handlers/user-start-stop.ts:147:20)
      at startStopTask (src/plugin.ts:22:14)
      at Object.<anonymous> (tests/pull-request.test.ts:128:5)

    console.warn
         {
            "err": {},
            "caller": "error"
          }

      81 |     return { role, limit };
      82 |   } catch (err) {
    > 83 |     logger.error("Could not get user role", { err });
         |            ^
      84 |     return { role: "unknown", limit: maxConcurrentTasks.contributor };
      85 |   }
      86 | }

      at PrettyLogs._log (node_modules/@ubiquity-os/ubiquity-os-logger/dist/index.js:149:7)
      at PrettyLogs._logWithStack (node_modules/@ubiquity-os/ubiquity-os-logger/dist/index.js:89:14)
      at PrettyLogs.error (node_modules/@ubiquity-os/ubiquity-os-logger/dist/index.js:51:10)
      at _Logs._log (node_modules/@ubiquity-os/ubiquity-os-logger/dist/index.js:174:7)
      at _Logs.error (node_modules/@ubiquity-os/ubiquity-os-logger/dist/index.js:234:17)
      at error (src/handlers/shared/get-user-task-limit-and-role.ts:83:12)
      at getUserRoleAndTaskLimit (src/handlers/shared/start.ts:76:33)
      at start (src/handlers/user-start-stop.ts:147:20)
      at startStopTask (src/plugin.ts:22:14)
      at Object.<anonymous> (tests/pull-request.test.ts:128:5)

    console.warn
             getUserRoleAndTaskLimit (/Users/tomaz/ubiquity/command-start-stop/src/handlers/shared/start.ts:76:33)
              start (/Users/tomaz/ubiquity/command-start-stop/src/handlers/user-start-stop.ts:147:20)
              startStopTask (/Users/tomaz/ubiquity/command-start-stop/src/plugin.ts:22:14)
              Object.<anonymous> (/Users/tomaz/ubiquity/command-start-stop/tests/pull-request.test.ts:128:5)

      81 |     return { role, limit };
      82 |   } catch (err) {
    > 83 |     logger.error("Could not get user role", { err });
         |            ^
      84 |     return { role: "unknown", limit: maxConcurrentTasks.contributor };
      85 |   }
      86 | }

      at PrettyLogs._log (node_modules/@ubiquity-os/ubiquity-os-logger/dist/index.js:149:7)
      at PrettyLogs._logWithStack (node_modules/@ubiquity-os/ubiquity-os-logger/dist/index.js:94:14)
      at PrettyLogs.error (node_modules/@ubiquity-os/ubiquity-os-logger/dist/index.js:51:10)
      at _Logs._log (node_modules/@ubiquity-os/ubiquity-os-logger/dist/index.js:174:7)
      at _Logs.error (node_modules/@ubiquity-os/ubiquity-os-logger/dist/index.js:234:17)
      at error (src/handlers/shared/get-user-task-limit-and-role.ts:83:12)
      at getUserRoleAndTaskLimit (src/handlers/shared/start.ts:76:33)
      at start (src/handlers/user-start-stop.ts:147:20)
      at startStopTask (src/plugin.ts:22:14)
      at Object.<anonymous> (tests/pull-request.test.ts:128:5)

Current behavior

For one logger.error, the logger is outputting 3 times, first time with just the message, second time with metadata and third time with the stack.
Another problem is that errors get printed as {} so every time I have to manually add a console.log to know what the actual error is.

Expected behavior

This is redundant because the stack is getting printed 3 times and message and metadata should be together otherwise it looks very confusing, so ideally it should look like this:

    console.warn
         Could not get user role
         {
            "err": "HttpError: 404",
            "caller": "error"
         }
           getUserRoleAndTaskLimit (/Users/tomaz/ubiquity/command-start-stop/src/handlers/shared/start.ts:76:33)
           start (/Users/tomaz/ubiquity/command-start-stop/src/handlers/user-start-stop.ts:147:20)
           startStopTask (/Users/tomaz/ubiquity/command-start-stop/src/plugin.ts:22:14)
           Object.<anonymous> (/Users/tomaz/ubiquity/command-start-stop/tests/pull-request.test.ts:128:5)
@SleepyDragon-foss
Copy link

/start

Copy link
Contributor

Caution

Please set your wallet address with the /wallet command first and try again.

@SleepyDragon-foss
Copy link

/wallet

Copy link
Contributor

Caution

Please provide your wallet address after to register it i.e.: /wallet 0xYourAddress
Write /wallet unset to remove your wallet.

@FibrinLab
Copy link

/start

Copy link
Contributor

Beneficiary 0x3EFFe91C62d1864C3B791Bc7bbD43b68B899d12A

Tip

  • Use /wallet 0x0000...0000 if you want to update your registered payment wallet address.
  • Be sure to open a draft pull request as soon as possible to communicate updates on your progress.
  • Be sure to provide timely updates to us when requested, or you will be automatically unassigned from the task.

Copy link
Contributor

Important

  • Be sure to link a pull-request before the first reminder to avoid disqualification.
  • Reminders will be sent every 3 days and 12 hours if there is no activity.
  • Assignees will be disqualified after 7 days of inactivity.

@FibrinLab FibrinLab linked a pull request Feb 6, 2025 that will close this issue
@gentlementlegen
Copy link
Member

gentlementlegen commented Feb 8, 2025

@whilefoo I can't reproduce locally printing three times the stack, however I can see the empty err: {}. However, from my understanding errors are meant to be properly printed if they are sent into the error item e.g. logger.error("", {error: err}) which is not the case in your example. That changes how the display is handled by the logger.

@whilefoo
Copy link
Member Author

whilefoo commented Feb 8, 2025

You're right. The logger does have a function convertErrorsIntoObjects but it's only use in fatal but even then it's only used if metadata is an Error but it's rarely used like that.
I will try to reproduce printing three times

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

Successfully merging a pull request may close this issue.

5 participants