-
Notifications
You must be signed in to change notification settings - Fork 124
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
Update logger to work with progress bar #1907
Conversation
Yup this |
Hi @jonahtanjz, nope it doesn't. I made this PR while attempting to resolve 1723 but I am facing a bit of a complication with how to properly interrupt the progress bar when logger.info/warn etc are called. Ideally when the progress bar is running, updates to the console can utilize the node-progress's
Sure I will make a quite PR to fix this. |
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.
so thought to at least bump the relevant dependencies as a first step.
Alright in that case LGTM 👍
Updated this PR as I discovered that the error stack trace disappeared after upgrading Winston.
|
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.
Thanks for working on this @tlylt!
Mostly looks good. The warnings are now on separate lines 👍 However, I found an edge case which still causes the line break issue (this time with the site data built
log).
To replicate this issue:
- Create a
.mbd
extension file and include it in thesite.json
- Serve the site
- Error should show up and no linebreak after progress bar
Will also need to account for this case as similar errors may lead to this issue as well.
Log file if you need it for reference:
markbind-2022-04-19.log
Some updates to be done and hence re-approval required
Heads up, |
Hi @jonahtanjz To give a bit of an update:
I'm not sure how to make this solution better at the moment... as I am facing some complications finding out how to update the progress bar in |
Thanks for updating @tlylt
I'll need some time to look into this. In the meantime, I am fine with the current implementation of placing the progress bar at the end :) |
It seems that the issue with this is that the One workaround that we can do is to introduce another counter in I've come up with some rough/draft code that I think resolves this issue (tlylt#4). Feel free to take a look at it :) |
Hi @jonahtanjz, I tried the changes in your PR to my branch. If I do comment out the infoWrap, the last newline is not working: May I double-check if you have any additional changes that are not pushed to the PR? |
Nope I did not make any other changes. I realised this issue reappears if there are more pages to generate. The page generation will take in a maximum of 4 pages to generate concurrently, as a result, if any of the pages fails, the promise will get rejected and the other pages will not be generated. This causes the
Let's go with this then in view of the above issue. |
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.
Thanks @tlylt for the workaround :)
LGTM 👍
What is the purpose of this pull request?
Overview of changes:
Fixes #1723, which is related to the first task of #1633
Some patching is done to the node-progress package to add helper methods that allow loggers to interrupt the progress barUpdate the logger packages (winston
andwinston-daily-rotate-file
)some patching is done to ensure that error stack trace is properly printed outAdjustments were made to preserve the CLI output, with the exception that the new version of winston prepends 3 white space characters before the message, hence the gap between the level label and the message is slightly wider:beforeafterAnything you'd like to highlight / discuss:
Irrelevant observation: In the core package'spackage-lock.json
, the version of core is still 3.0.6. Actually not sure if this lock file needs to exist at all...(resolved)
Testing instructions:
markbind serve
/markbind build
to verify the CLI output_markbind/logs
to see the content of .log filesCan consider running
npm run test
, which will have quite a bit of console logging that is resulted from running all the functional tests, hence can observe the console behavior.Proposed commit message: (wrap lines at 72 characters)
Update logger to work with progress bar
When the page build task is ongoing, the progress bar
shown is interrupted unexpectedly by warnings or error
logs, which will be written to the console without any
preceding linebreak.
Let's patch the node-progress package to signal the
start and the end of a proper interruption, and have
the loggers invoke these methods before and after
logging. Let's also upgrade the logger dependencies.
When the progress bar is running, the loggers will
call the relevant method to clear off the current bar
before logging and redraws the progress bar afterward.
Checklist: ☑️