@@ -3,14 +3,14 @@ package basic_workflows
3
3
import (
4
4
"bufio"
5
5
"bytes"
6
+ "io"
6
7
"os"
7
8
8
9
"github.com/snyk/cli/cliv2/internal/proxy/interceptor"
9
10
10
11
"github.com/pkg/errors"
11
12
"github.com/rs/zerolog"
12
13
"github.com/snyk/go-application-framework/pkg/configuration"
13
- "github.com/snyk/go-application-framework/pkg/logging"
14
14
pkg_utils "github.com/snyk/go-application-framework/pkg/utils"
15
15
"github.com/snyk/go-application-framework/pkg/workflow"
16
16
"github.com/spf13/pflag"
@@ -66,7 +66,6 @@ func legacycliWorkflow(
66
66
output = []workflow.Data {}
67
67
var outBuffer bytes.Buffer
68
68
var outWriter * bufio.Writer
69
- var errWriter * bufio.Writer
70
69
71
70
config := invocation .GetConfiguration ()
72
71
debugLogger := invocation .GetEnhancedLogger () // uses zerolog
@@ -103,23 +102,25 @@ func legacycliWorkflow(
103
102
if len (apiToken ) == 0 {
104
103
apiToken = "random"
105
104
}
106
- cli .AppendEnvironmentVariables ([]string {constants .SNYK_API_TOKEN_ENV + "=" + apiToken })
105
+ cli .AppendEnvironmentVariables ([]string {constants .SNYK_API_TOKEN_ENV + "=" + apiToken , "DEBUG_HIDE_DATE=true" })
107
106
108
107
err = cli .Init ()
109
108
if err != nil {
110
109
return output , err
111
110
}
112
111
113
- scrubDict := logging .GetScrubDictFromConfig (config )
114
- scrubbedStderr := logging .NewScrubbingIoWriter (os .Stderr , scrubDict )
112
+ // if debug is enabled, stderr will be directly using the debuglogger otherwise, stderr will be stderr
113
+ var stderr io.Writer = os .Stderr
114
+ if config .GetBool (configuration .DEBUG ) {
115
+ stderr = debugLogger
116
+ }
115
117
116
118
if ! useStdIo {
117
119
in := bytes .NewReader ([]byte {})
118
120
outWriter = bufio .NewWriter (& outBuffer )
119
- errWriter = bufio .NewWriter (scrubbedStderr )
120
- cli .SetIoStreams (in , outWriter , errWriter )
121
+ cli .SetIoStreams (in , outWriter , stderr )
121
122
} else {
122
- cli .SetIoStreams (os .Stdin , os .Stdout , scrubbedStderr )
123
+ cli .SetIoStreams (os .Stdin , os .Stdout , stderr )
123
124
}
124
125
125
126
wrapperProxy , err := createInternalProxy (
@@ -137,7 +138,6 @@ func legacycliWorkflow(
137
138
138
139
if ! useStdIo {
139
140
outWriter .Flush ()
140
- errWriter .Flush ()
141
141
142
142
contentType := "text/plain"
143
143
if pkg_utils .Contains (args , "--json" ) || pkg_utils .Contains (args , "--sarif" ) {
0 commit comments