Unitech / Unitech/pm2

Do not override console.log

Open
#2,773 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

P3: Medium SYS: Daemon T: Enhancement
Dominant language
JavaScript
Stars
43.3k
Forks
2.7k
PR merge metrics
No merged PRs in 30d

Description

Expected behaviour

Using PM2 programmatically should not override console.log's native behavior when PM2 daemon is not spawned.

For example, console.log({a: 2}) should print { a: 2 }

Actual behaviour

Utility.overrideConsole() is called

In the example above, 2017-03-16 15:27:05: [object Object] is printed 😞

Steps to reproduce

$ pm2 kill

require('pm2').connect(true, () => console.log({a: 2}))
Software versions used
OS         : Windows 10
node.js    : v6.10.0
PM2        :2.0.12 up to 2.4.2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the programmatic connect path from require('pm2').connect(true, ...) to Utility.overrideConsole(). Reproduce the issue after pm2 kill with console.log({a: 2}); done means the native object formatting remains unchanged when the PM2 daemon is not spawned, while normal PM2 behavior is preserved.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.