Skip to content

Commit 5adcfa3

Browse files
committed
Add warning log when processTokens is passed without M3 mode
1 parent 2601bf3 commit 5adcfa3

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

internal/agent/agent.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func Run() error {
2626

2727
// Validation: if no mode is specified (neither M3, OnDemand, nor API Mode), abort here
2828
if !onDemandMode && !apiMode && !m3Mode {
29-
logger.Log("WARNING: M3 mode is not enabled. API mode is not enabled. The yc-360 script is about to run OnDemand mode but no PID is specified.")
29+
logger.Warn().Msg("M3 mode is not enabled. API mode is not enabled. The yc-360 script is about to run OnDemand mode but no PID is specified.")
3030

3131
return ErrNothingCanBeDone
3232
}
@@ -92,7 +92,7 @@ func runAPIMode() {
9292

9393
err := apiServer.Serve()
9494
if err != nil {
95-
logger.Log("WARNING: %s", err)
95+
logger.Warn().Msg(err.Error())
9696
}
9797
}
9898

internal/cli/validation.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,14 @@ func validate() error {
3333
}
3434

3535
if config.GlobalConfig.M3 && config.GlobalConfig.OnlyCapture {
36-
logger.Log("WARNING: -onlyCapture will be ignored in m3 mode.")
36+
logger.Warn().Msg("-onlyCapture will be ignored in m3 mode.")
3737
config.GlobalConfig.OnlyCapture = false
3838
}
3939

40+
if len(config.GlobalConfig.ProcessTokens) > 0 && !config.GlobalConfig.M3 {
41+
logger.Warn().Msg("ProcessTokens is passed without M3 mode. See https://docs.ycrash.io/yc-360/launch-modes/m3-mode.html")
42+
}
43+
4044
if config.GlobalConfig.AppLogLineCount < -1 {
4145
logger.Log("%d is not a valid value for 'appLogLineCount' argument. It should be -1 (all lines), 0 (no logs), or a positive number.", config.GlobalConfig.AppLogLineCount)
4246
return ErrInvalidArgumentCantContinue

0 commit comments

Comments
 (0)