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

Commit 5809c0a

Browse files
committed
[CBR-275] simplified LoggerName
Signed-off-by: Alexander Diemand <[email protected]>
1 parent 0e300b4 commit 5809c0a

File tree

3 files changed

+21
-16
lines changed

3 files changed

+21
-16
lines changed

networking/src/Network/Broadcast/OutboundQueue/Demo.hs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ runEnqueue = id
4444

4545
relayDemo :: IO ()
4646
relayDemo = do
47-
updateGlobalLogger "*production*" (setLevel noticePlus)
48-
4947
let block :: Text -> [Node] -> Enqueue () -> Enqueue ()
5048
block label nodes act = do
5149
usingLoggerName (fromString "outboundqueue-production") $ logNotice label

tools/src/dbgen/Main.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ import Pos.Tools.Dbgen.Lib (generateWalletDB, loadGenSpec)
4848
import Pos.Tools.Dbgen.Rendering (bold, say)
4949
import Pos.Tools.Dbgen.Stats (showStatsAndExit, showStatsData)
5050
import Pos.Tools.Dbgen.Types (UberMonad)
51-
import Pos.Util.Wlog (HasLoggerName (..), LoggerName (..))
51+
import Pos.Util.Wlog (HasLoggerName (..))
5252

5353
defaultNetworkConfig :: Topology kademlia -> NetworkConfig kademlia
5454
defaultNetworkConfig ncTopology = NetworkConfig {
@@ -126,7 +126,7 @@ newRealModeContext coreConfig txpConfig dbs confOpts publicKeyPath secretKeyPath
126126
<*> pure nrTxpState
127127
<*> pure nrDlgState
128128
<*> jsonLogConfigFromHandle stdout
129-
<*> pure (LoggerName "dbgen")
129+
<*> pure "dbgen"
130130
<*> pure nrContext
131131
<*> pure noReporter
132132
-- <*> initQueue (defaultNetworkConfig (TopologyAuxx mempty)) Nothing

tools/src/launcher/Main.hs

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ import Pos.DB.Rocks (NodeDBs, closeNodeDBs, dbDeleteDefault,
7575
dbWriteBatchDefault, openNodeDBs)
7676
import Pos.DB.Update (affirmUpdateInstalled)
7777
import Pos.Infra.Reporting.Http (sendReport)
78-
import Pos.Infra.Reporting.Wlog (compressLogs, retrieveLogFiles)
78+
import Pos.Infra.Reporting.Wlog (compressLogs)
7979
import Pos.Launcher (HasConfigurations, withConfigurations)
8080
import Pos.Launcher.Configuration (ConfigurationOptions (..))
8181
import Pos.Network.Update.Download (installerHash)
@@ -84,11 +84,13 @@ import Pos.Util (HasLens (..), directory, logException,
8484
postfixLFields)
8585
import Pos.Util.CompileInfo (HasCompileInfo, compileInfo,
8686
withCompileInfo)
87-
import Pos.Util.Log.LoggerConfig (defaultInteractiveConfiguration,
87+
import Pos.Util.Log.LoggerConfig (BackendKind (..), LogHandler (..),
88+
LogSecurityLevel (..), defaultInteractiveConfiguration,
89+
lcBasePath, lcLoggerTree, ltHandlers, ltMinSeverity,
8890
retrieveLogFiles)
89-
import Pos.Util.Wlog (LoggerNameBox (..), Severity (Debug),
90-
lcBasePath, lcLoggerTree, logError, logInfo, logNotice,
91-
logWarning, usingLoggerName)
91+
import Pos.Util.Wlog (LoggerNameBox (..), Severity (Info), logError,
92+
logInfo, logNotice, logWarning, setupLogging,
93+
usingLoggerName)
9294

9395
import Pos.Tools.Launcher.Environment (substituteEnvVarsValue)
9496
import Pos.Tools.Launcher.Logging (reportErrorDefault)
@@ -299,18 +301,22 @@ main =
299301
case loNodeLogConfig of
300302
Nothing -> loNodeArgs
301303
Just lc -> loNodeArgs ++ ["--log-config", toText lc]
302-
setupLogging Nothing $
303-
defaultInteractiveConfiguration Debug
304+
setupLogging $
305+
defaultInteractiveConfiguration Info
304306
& lcBasePath .~ launcherLogsPrefix
305307
& lcLoggerTree %~ case launcherLogsPrefix of
306308
Nothing ->
307309
identity
308310
Just _ ->
309-
(ltHandlers %~ (\xs -> LogHandler { _lhName="node", _lhFpath=Just "node.log"
310-
, _lhBackend=FileTextBE
311-
, _lhMinSeverity=Just Debug
312-
, _lhSecurityLevel=Just PublicLogLevel} : xs)) .
313-
set ltMinSeverity Debug
311+
(ltHandlers %~ (\xs -> [LogHandler { _lhName="node", _lhFpath=Just "node.log"
312+
, _lhBackend=FileTextBE
313+
, _lhMinSeverity=Just Info
314+
, _lhSecurityLevel=Just SecretLogLevel}
315+
,LogHandler { _lhName="json", _lhFpath=Just "pub/node.pub"
316+
, _lhBackend=FileJsonBE
317+
, _lhMinSeverity=Just Info
318+
, _lhSecurityLevel=Just PublicLogLevel}] ++ xs)) .
319+
set ltMinSeverity Info
314320
logException loggerName . usingLoggerName loggerName $
315321
withConfigurations Nothing loConfiguration $ \coreConfig _ _ -> do
316322

@@ -721,6 +727,7 @@ reportNodeCrash
721727
-> M ()
722728
reportNodeCrash pm exitCode _ logConfPath reportServ = do
723729
logConfig <- readLoggerConfig (toString <$> logConfPath)
730+
-- TODO this should be moved where we have access to logfiles
724731
let logFileNames =
725732
map ((fromMaybe "" (logConfig ^. lcBasePath) </>) . snd) $
726733
retrieveLogFiles logConfig

0 commit comments

Comments
 (0)