Parcel: ๐Ÿ™‹Add verbose logging mode

Created on 13 Mar 2018  ยท  10Comments  ยท  Source: parcel-bundler/parcel

Choose one: is this a ๐Ÿ› bug report or ๐Ÿ™‹ feature request?

๐Ÿ™‹ feature request

It's impossible to debug an issue or to show anyone if I can't see what's happening. All logging messages are replaced one the build is done.

๐ŸŽ› Configuration (.babelrc, package.json, cli command)

parcel watch

๐Ÿค” Expected Behavior

$ parcel watch --verbose
Server running at http://localhost:1234 
โณ  Building index.html...
โณ  Building index.js...
โœจ  Built in 3.78s.
โณ  Building index.js...
โœจ  Built in 0.78s.
โณ  Building index.html...
โœจ  Built in 0.1s.

๐Ÿ˜ฏ Current Behavior

$ parcel watch
Server running at http://localhost:1234 
โœจ  Built in 3.78s.
# what happened?! what did it do?

๐Ÿ”ฆ Context

Mostly for debugging purposes

๐ŸŒ Your Environment

| Software | Version(s) |
| ---------------- | ---------- |
| Parcel | 1.6.2
| Node | 8.6.0
| npm/Yarn | 5.7.1
| Operating System | macOS 10.13.3

Good First Issue Help Wanted Feature

Most helpful comment

So once I add --log-level 2 to my start script, where CAN I SEE IT?
Is it written to a file, & if so, WHERE?

All 10 comments

This should be VERY easy to implement ๐Ÿ˜ƒ ๐Ÿ˜‡ ๐Ÿš€

We already have an option called logLevel that we use internally. So it's just a matter of exposing that in src/cli.js.

The easiest way to do it is to make the CLI option called --logLevel [level] which would just take the that level as a parameter directly (however this would probably require us to document how those log levels actually work).

If you just add that to the commands in src/cli.js, it should just automatically start working, since the code that parses that option already exists ๐Ÿ‘

@davidnagli We don't have a verbose level though, this would require someone to add an extra level to the loglevel value for example go up to lvl 4 instead of 3, 4 being verbose

@DeMoorJasper How is lvl 3 different from the verbose mode that @bfred-it is describing?

What would be new in lvl 4?

If i understand correctly the difference would be that it prints everything (like not overwriting status but just taking a newline every time)

Gochya ๐Ÿ‘

We should probably document the log levels somewhere. From what I pieced together:

| logLevel | Behavior |
| ------- | ---------- |
| 0 | No output
| 1 | Errors
| 2 | Warnings + Errors
| 3 | All
| 4 | [Proposed] Verbose

Is this issue still being worked on? I'd be interested in starting to contribute too this project and this seems like a good starting point.

@TomVance #1385 is the PR that contains the verbose output and also a log file generation. If you find something there that is missing feel free to contribute based on the PR. ๐Ÿ˜‰

This would be super helpful! Two engs here (myself included) just spent a day trying to figure out _when_ our Parcel build was hanging โ€“ as in, which file it was hung up on. Without an option to capture the output, we had no insight.

(Side note: It turned out to be a node-sass absolute vs relative import problem on an ubuntu:trusty Docker image, which we'd also like to submit an issue for but haven't figured out how to reliably reproduce the environment for you yet.)

I'll open up a new PR that does the same as my current one but without any log calls, as I haven't had the chance to reliably performance test the difference (and there are a couple merge conflicts)

So once I add --log-level 2 to my start script, where CAN I SEE IT?
Is it written to a file, & if so, WHERE?

Was this page helpful?
0 / 5 - 0 ratings