Skip to content

Conversation

@MatrixFrog
Copy link
Contributor

issue reported here: #1128 (comment)

@MatrixFrog MatrixFrog mentioned this pull request Feb 8, 2022
@mmrwoods
Copy link

mmrwoods commented Feb 8, 2022

Thanks @MatrixFrog, this does remove the undefined from the output, but unfortunately doesn't solve the incompatibility with forever-service because Winston v3 also colorizes output by default (so the sed command to find the service status still fails).

Changing the format from winston.format.cli() to winston.format.simple() seems to work perfectly though, it removes the colors and generates output compatible with forever-service :-)

I guess to fix this properly, you'd have to check if the forever cli arguments --plain or --no-color were passed and use the appropriate format.

@mmrwoods
Copy link

mmrwoods commented Feb 8, 2022

FWIW, this addition solves the problem. I don't like it because of the need to require winston within cli.js, but as a PoC it does work...

diff --git a/lib/forever/cli.js b/lib/forever/cli.js
index d63163a..7d6a506 100644
--- a/lib/forever/cli.js
+++ b/lib/forever/cli.js
@@ -16,6 +16,7 @@ var fs = require('fs'),
     prettyjson = require('prettyjson'),
     clone = require('clone'),
     objectAssign = require('object-assign'),
+    winston = require("winston"),
     forever = require('../forever');

 var cli = exports;
@@ -627,6 +628,7 @@ cli.start = function () {
   //
   if ((typeof app.argv.colors !== 'undefined' && !app.argv.colors) || app.argv.plain) {
     colors.mode = 'none';
+    forever.log.format = winston.format.simple();
   }

   if (app.config.get('help')) {

@MatrixFrog
Copy link
Contributor Author

feel free to update this PR with whatever changes you would like

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants