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

Pretty Print MongoDB server output #599

Open
hasezoey opened this issue Jan 18, 2022 · 15 comments
Open

Pretty Print MongoDB server output #599

hasezoey opened this issue Jan 18, 2022 · 15 comments

Comments

@hasezoey
Copy link
Collaborator

hasezoey commented Jan 18, 2022

for mongodb 4.4, they have changed to use logs as json, currently we are printing them as-is, but it is pretty hard to debug as they are

this is a tracking issue for pretty printing this new log output

implementation details:

  • only process the lines when debug mode is enabled (for the MongoInstance file)
  • process each new line separately
  • process JSON into something resembling like the old log format
  • have a flag to disable this pretty-printing (because this can be really resource intensive)

also, a alternative could be to write something to read in the finished log and colorize and sort it for faster debugging

@aryabharat
Copy link

Hi @hasezoey! if no one is picking this issue i can pick this.

@hasezoey
Copy link
Collaborator Author

if no one is picking this issue i can pick this.

you can try if you want to, i would recommend reading CONTRIBUTING first

@Aspireve
Copy link

Hey Hi!! @hasezoey
I would like to work on this issue if possible. I have used TypeScript for the past some time. However I am not quite that very great at it, so would you advise me to work on it or would it be a bit out of my reach.

@hasezoey
Copy link
Collaborator Author

@Aspireve you can work on it and open a PR (probably in DRAFT mode), you can also join our discord and ask questions there

@Aspireve
Copy link

Ohh Awesome!! I'll start by going over the CONTRIBUTING file and skimming over the code (PS I joined the Discord Server)

@Aspireve
Copy link

Heyy @hasezoey!! Could you explain this issue. I actually wasn't able to quite understand it. Do I actually have to make the pretty format only when in debugging? Also does it have to be done to the output or just the console logs? (PS I currently forked the repository an will create a DRAFT PR soon)

@hasezoey
Copy link
Collaborator Author

Do I actually have to make the pretty format only when in debugging?

yes, because i assume doing JSON.parse over many lines so often will be quite a performance hit, especially when the logs arent even shown anywhere (they are only shown / printed when debugging is on)

Also does it have to be done to the output or just the console logs?

i dont quite understand the question, the logs from mongodb output in MongoInstance.stdoutHandler would have to be parsed for every line (and maybe also .stderrHandler)

@Aspireve
Copy link

Ohh Ok, I got what you are saying!! Thanks!!

@Aspireve
Copy link

Hey also @hasezoey should I fork it and create a new branch in my repo and work there or should I just clone this repo and work on the beta branch? Cause I guess it not mentioned in the CONTRIBUTING.md

Also should I create an Issue about the same so that someone else could solve it later?

@hasezoey
Copy link
Collaborator Author

Hey also @hasezoey should I fork it and create a new branch in my repo and work there or should I just clone this repo and work on the beta branch?

it does not matter which branch you work on as long as it is a fork, the only thing to keep in mind is if you want to keep the main branches of the main repo and your fork in sync, you will have to fore-push to your repo

Also should I create an Issue about the same so that someone else could solve it later?

no i dont think that is required

@Aspireve
Copy link

Aspireve commented May 24, 2023

Ohh cool!! Also how do I setup this project and run it?

Also TypeScript is shooting some weird errors in other files than the core module
image

(Sorry a lot of questions lol)

@hasezoey
Copy link
Collaborator Author

@Aspireve those questions are not related to the issue at hand, please ask them in discussions or preferably on discord

*if any of the questions are non-specific, they may get added to CONTRIBUTING or some other place


as for how to run the project (tests) run either in root yarn run test or in packages/mongodb-memory-server-core/ yarn run coverage (or also just test, but coverage is faster because it does not do extra steps)

@Aspireve
Copy link

as for how to run the project (tests) run either in root yarn run test or in packages/mongodb-memory-server-core/ yarn run coverage (or also just test, but coverage is faster because it does not do extra steps)

Ohh cool!! Thanks!!

@Aspireve
Copy link

Hey after running coverage it's begun installing 2-3 MongoDBs with very different versions, is it the correct method of working or am I doing something completely wrong lol

@hasezoey
Copy link
Collaborator Author

hasezoey commented May 24, 2023

@Aspireve like i said, this is not part of this issue, please keep it to github discussions or preferably our discord

and yes, that is expected and normal

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

No branches or pull requests

3 participants