joshwcomeau / guppy

🐠A friendly application manager and task runner for React.js
ISC License
3.27k stars 154 forks source link

Process logger #287

Closed AWolf81 closed 5 years ago

AWolf81 commented 5 years ago

Summary: Some tasks don't have a terminal where messages are logged (e.g. eject). So debugging is pretty difficult.

That's why I'd like to add a process logging service. I've added it to all child processes except CreateProject - I think we can add more logging later.

The logging can be enabled/disabled in app/config.js with LOGGING. Logging is always disabled in production. Maybe we could add a command line argument so logging could be enabled if required e.g. with --debug in production.

Please let me know what do you think - is it worth to add? For me it helped to see why eject task failed.

superhawk610 commented 5 years ago

Shameless plug for my logging package. Giving these logs their own colors or a single color for all of them would make them stand out from other miscellaneous messages in the console.

AWolf81 commented 5 years ago

@superhawk610 Not sure if we can use your logging package as there are control characters inside the logs that are not properly parsed - I think they would tell something about coloring. For coloring we could also use chalk. I think it's OK to have it not colored but the control characters are a bit confusing. Maybe we could strip them out so debugging is easier.

AWolf81 commented 5 years ago

@melanieseltzer what do you think? Anything open except the log for devServer where it is not really needed but I like it as we sometimes have a stripped down logging in the Guppy output - so we can see everything.

I think we could improve this and the control characters in the console later. I'd like to have it as this is pretty useful. I needed it for the refactoring of the project creation so I merged it into that branch.

codecov[bot] commented 5 years ago

Codecov Report

Merging #287 into master will increase coverage by 0.09%. The diff coverage is 46.15%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #287      +/-   ##
==========================================
+ Coverage   20.09%   20.18%   +0.09%     
==========================================
  Files         235      236       +1     
  Lines        3648     3661      +13     
  Branches      368      370       +2     
==========================================
+ Hits          733      739       +6     
- Misses       2648     2654       +6     
- Partials      267      268       +1
Impacted Files Coverage Ξ”
src/config/app.js 100% <ΓΈ> (ΓΈ) :arrow_up:
src/services/dependencies.service.js 25% <0%> (-1.32%) :arrow_down:
src/sagas/task.saga.js 60.71% <100%> (+1.08%) :arrow_up:
src/services/process-logger.service.js 33.33% <33.33%> (ΓΈ)