@@ -21,7 +21,7 @@ module User.Agent.Process
21
21
import Cli (Command (.. ), TokenInfoFailure , WithValidation (.. ), cmd )
22
22
import Control.Applicative (Alternative (.. ), optional )
23
23
import Control.Concurrent (threadDelay )
24
- import Control.Monad (forever )
24
+ import Control.Monad (forever , when )
25
25
import Control.Monad.IO.Class (MonadIO (.. ))
26
26
import Control.Monad.Trans.Except (runExceptT , throwE )
27
27
import Core.Options (tokenIdOption , walletOption )
@@ -52,6 +52,8 @@ import OptEnvConf
52
52
, setting
53
53
, short
54
54
, strOption
55
+ , switch
56
+ , value
55
57
, withYamlConfig
56
58
)
57
59
import Options (githubAuthOption , secretsFileOption )
@@ -133,6 +135,7 @@ data ProcessOptions = ProcessOptions
133
135
, poTrustedCreators :: [Username ]
134
136
, poRegistry :: Registry
135
137
, poAntithesisAuth :: AntithesisAuth
138
+ , poVerbose :: Bool
136
139
}
137
140
138
141
processOptionsParser :: Parser ProcessOptions
@@ -149,6 +152,17 @@ processOptionsParser =
149
152
<*> creatorsOption
150
153
<*> registryOption
151
154
<*> antithesisAuthOption
155
+ <*> verboseOption
156
+
157
+ verboseOption :: Parser Bool
158
+ verboseOption =
159
+ setting
160
+ [ long " verbose"
161
+ , help " Enable verbose logging."
162
+ , metavar " VERBOSE"
163
+ , switch True
164
+ , value False
165
+ ]
152
166
153
167
creatorsOption :: Parser [Username ]
154
168
creatorsOption =
@@ -178,7 +192,7 @@ creatorsOption =
178
192
agentProcess
179
193
:: ProcessOptions
180
194
-> IO ()
181
- agentProcess opts@ ProcessOptions {poPollIntervalSeconds} = do
195
+ agentProcess opts@ ProcessOptions {poPollIntervalSeconds, poVerbose } = do
182
196
putStrLn " Starting agent process service..."
183
197
forever $ runExceptT $ do
184
198
results <- liftIO $ pollEmails opts
@@ -231,7 +245,7 @@ agentProcess opts@ProcessOptions{poPollIntervalSeconds} = do
231
245
++ trId
232
246
++ " in transaction "
233
247
++ show txHash
234
- Just (Right _) -> do
248
+ Just (Right _) -> when poVerbose $ do
235
249
loggin
236
250
$ " Test-run "
237
251
++ trId
0 commit comments