-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
[WIP] Logger improvements #207
[WIP] Logger improvements #207
Conversation
DeMoorJasper
commented
Dec 11, 2017
•
edited
Loading
edited
- Change logger into a global accessible Singleton
- Improve message outputting to not overwrite and glitch
- Add the ability to make any message persistent
- Full control over the console
Add new improvements
Add all new commits
Change to uglify es & output uglify errors (#157)
…/parcel into feature/logger-enhancements
I see you found the solution for your logger issue in #157 👍 |
+1 for converting |
src/Bundler.js
Outdated
this.logger.warn(err); | ||
setTimeout(() => { | ||
logger.warn(err); | ||
}, 500); |
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.
Whats the 0.5 second delay for?
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 that the warning doesn't get removed when the builder actually starts and does logger.clear()
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.
Nvm this is no longer necessary in the latest version...
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.
😬 merge conflicts.
Seems like a worthwhile resolve / merge.
…/parcel into feature/logger-enhancements
All conflicts should be fixed now @brandon93s |
Thanks @DeMoorJasper! I tried this out locally. A couple things:
|
@devongovett i removed the singleton pattern, just wondering how u see implementing the IPC, as far as i've thought about it i think it would overwrite messages by parcel or cause the glitches i tried to fix in the first place with keeping an array with all messages (overwriting status every time and having full control over the output on clear and rewrites) |
Sorry I wasn't clear. I DID like the singleton pattern you had, we just need to add something so that the instances in workers don't overwrite each other. Maybe something like this could work? The child would intercept writes to the logger and send them to the master. write(message) {
if (process.send) {
// we're in a worker
process.send({type: 'log', message});
} else {
// do actual write here
}
}
process.on('message', msg => {
if (msg.type === 'log') {
Logger.write(msg.message);
}
}); |
src/Logger.js
Outdated
let hasStatusLine = this.statusLine != null; | ||
if (!hasStatusLine) { | ||
this.statusLine = this.lines; | ||
handleMessage(options) { |
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.
handleMessage
could be simplified as:
handleMessage(options) {
this[options.method](...options.args);
}
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 this, changed it
src/Logger.js
Outdated
} | ||
|
||
module.exports = Logger; | ||
module.exports = getLogger(); |
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.
We should probably export Logger rather than an instance, so that it's possible to inherit from Logger
or extend it with mixins.
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.
I'm not sure if this is really necessary but i exported both in new improvements
Closing this in favor of #462 once I figure out how to make the statuses not glitch i'll just open up a new PR. |
A problem here on xterm + bash + Ubuntu. |