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

add logger #446

Merged
merged 6 commits into from
Jul 17, 2024
Merged

add logger #446

merged 6 commits into from
Jul 17, 2024

Conversation

diegoalzate
Copy link
Contributor

@diegoalzate diegoalzate commented Jul 12, 2024

overview

adds a pino logger, this is a very lightweight one.

there are levels of logs shown in the comment, by default it is put to info which means it includes that and everything before that level.

for example to see less you can run:

LOG_LEVEL=fatal pn dev

for tests to see logs you can run

LOG_LEVEL=debug pn dev

@diegoalzate diegoalzate self-assigned this Jul 12, 2024
@diegoalzate diegoalzate changed the title add pino add logger Jul 12, 2024
@diegoalzate diegoalzate marked this pull request as ready for review July 15, 2024 13:08
Copy link
Collaborator

@MartinBenediktBusch MartinBenediktBusch left a comment

Choose a reason for hiding this comment

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

  • there are still two instances of console.log in /handlers/options.ts
  • the tests pass but somehow errors related to the harts ratio are returned:

benedikt@LAPTOP-51EETM3E:~/forum-backend$ pnpm test src/services/questions.spec.ts

[email protected] test /home/benedikt/forum-backend
jest --runInBand "src/services/questions.spec.ts"

 PASS  src/services/questions.spec.ts
  service: forumQuestions
    ✓ calculates available hearts correctly (2 ms)
    ✓ error if max ratio was not calculated correctly
    ✓ returns custom hearts if customHearts is set
    ✓ executes the function if customHearts is not set
    ✓ executes the function if customHearts is set to less than 2
    ✓ that function returns 0 in case the number of proposals are less than 2

Test Suites: 1 passed, 1 total
Tests:       6 passed, 6 total
Snapshots:   0 total
Time:        2.474 s
Ran all test suites matching /src\/services\/questions.spec.ts/i.
[10:03:30.311] ERROR (10674): baseNumerator/baseDenominator does not equal the specified max ratio
[10:03:30.313] ERROR (10674): Number of proposals must be at least 2
  • in services/question.ts question_options should be changed to options in the raw sql query.

@MartinBenediktBusch MartinBenediktBusch self-requested a review July 16, 2024 16:40
Copy link
Collaborator

@MartinBenediktBusch MartinBenediktBusch left a comment

Choose a reason for hiding this comment

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

remove unused dependency: import { logger } from '../utils/logger'; from services/votes

@MartinBenediktBusch MartinBenediktBusch self-requested a review July 17, 2024 08:30
Copy link
Collaborator

@MartinBenediktBusch MartinBenediktBusch left a comment

Choose a reason for hiding this comment

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

lgtm now

@diegoalzate diegoalzate merged commit fc5e6cd into next-v2.6.0 Jul 17, 2024
3 checks passed
@diegoalzate diegoalzate deleted the diego/add-logger branch July 17, 2024 08:47
diegoalzate added a commit that referenced this pull request Jul 30, 2024
* add pino

* replace console with logger

* fix conflicts

* update errors

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

Successfully merging this pull request may close these issues.

2 participants