Skip to content
This repository was archived by the owner on Aug 18, 2020. It is now read-only.

Commit 8d3384c

Browse files
authored
Merge pull request #3785 from input-output-hk/adiemand/DEVOPS-1109/inhibit-console-log
[DEVOPS-1109] cli argument to inhibit console log: --log-console-off
2 parents 6b998ba + 51f1cb2 commit 8d3384c

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

lib/src/Pos/Client/CLI/Options.hs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import Pos.Launcher.Configuration (ConfigurationOptions (..))
3838
data CommonArgs = CommonArgs
3939
{ logConfig :: !(Maybe FilePath)
4040
, logPrefix :: !(Maybe FilePath)
41+
, logConsoleOff :: !Bool
4142
, reportServers :: ![Text]
4243
, updateServers :: ![Text]
4344
, configurationOptions :: !ConfigurationOptions
@@ -47,6 +48,7 @@ commonArgsParser :: Opt.Parser CommonArgs
4748
commonArgsParser = do
4849
logConfig <- optionalLogConfig
4950
logPrefix <- optionalLogPrefix
51+
logConsoleOff <- optionalLogConsoleOff
5052
reportServers <- reportServersOption
5153
updateServers <- updateServersOption
5254
configurationOptions <- configurationOptionsParser
@@ -114,9 +116,15 @@ optionalLogConfig =
114116

115117
optionalLogPrefix :: Opt.Parser (Maybe String)
116118
optionalLogPrefix =
117-
optional $ Opt.strOption $
119+
Opt.optional $ Opt.strOption $
118120
templateParser "logs-prefix" "FILEPATH" "Prefix to logger output path."
119121

122+
optionalLogConsoleOff :: Opt.Parser Bool
123+
optionalLogConsoleOff =
124+
Opt.switch $
125+
Opt.long "log-console-off" <>
126+
Opt.help "Inhibit logging to the console."
127+
120128
optionalJSONPath :: Opt.Parser (Maybe FilePath)
121129
optionalJSONPath =
122130
Opt.optional $ Opt.strOption $

lib/src/Pos/Client/CLI/Params.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ loggingParams defaultName CommonNodeArgs{..} =
3838
{ lpHandlerPrefix = logPrefix commonArgs
3939
, lpConfigPath = logConfig commonArgs
4040
, lpDefaultName = defaultName
41-
, lpConsoleLog = Nothing -- no override by default
41+
, lpConsoleLog = Just (not $ logConsoleOff commonArgs)
4242
}
4343

4444
getBaseParams :: LoggerName -> CommonNodeArgs -> BaseParams

tools/src/dbgen/Main.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ newRealModeContext genesisConfig txpConfig dbs confOpts publicKeyPath secretKeyP
9494
, commonArgs = CommonArgs {
9595
logConfig = Nothing
9696
, logPrefix = Nothing
97+
, logConsoleOff = True
9798
, reportServers = mempty
9899
, updateServers = mempty
99100
, configurationOptions = confOpts

util/src/Pos/Util/Log/Scribes.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ mkFileScribe rot sevfilter fdesc formatter colorize s v = do
9797
let tdiff' = round $ diffUTCTime rottime (_itemTime item)
9898
if bytes' < 0 || tdiff' < (0 :: Integer)
9999
then do -- log file rotation
100-
putStrLn $ "rotate! bytes=" ++ (show bytes') ++ " tdiff=" ++ (show tdiff')
101100
hClose hdl
102101
(hdl2, bytes2, rottime2) <- evalRotator rot fdesc
103102
return (hdl2, bytes2, rottime2)

0 commit comments

Comments
 (0)