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

Commit 9365bcb

Browse files
committed
[CBR-275] cleanup; revisit tests in 'util'
Signed-off-by: Alexander Diemand <[email protected]>
1 parent 49000f3 commit 9365bcb

File tree

12 files changed

+155
-82
lines changed

12 files changed

+155
-82
lines changed

infra/src/Pos/Infra/Reporting/Wlog.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import qualified Data.ByteString.Lazy as BSL
1818
import Data.Conduit (runConduitRes, yield, (.|))
1919
import Data.Conduit.List (consume)
2020
import qualified Data.Conduit.Lzma as Lzma
21-
import Data.List (isSuffixOf)
21+
import Data.List (isInfixOf)
2222
import qualified Data.Text.IO as TIO
2323
import Data.Time.Clock (getCurrentTime)
2424
import Data.Time.Format (defaultTimeLocale, formatTime)
@@ -66,7 +66,7 @@ readWlogFile logConfig = case mLogFile of
6666
-- first one.
6767
basepath = fromMaybe "./" $ logConfig ^. lcBasePath
6868
allFiles = map ((</> basepath) . snd) $ retrieveLogFiles logConfig
69-
mLogFile = case filter (".pub" `isSuffixOf`) allFiles of
69+
mLogFile = case filter (".json" `isInfixOf`) allFiles of
7070
[] -> Nothing
7171
(f:_) -> Just f
7272
-- 2 megabytes, assuming we use chars which are ASCII mostly

lib/src/Pos/Launcher/Resource.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ import Pos.Launcher.Param (BaseParams (..), LoggingParams (..),
6666
NodeParams (..))
6767
import Pos.Util (bracketWithLogging, newInitFuture)
6868
import Pos.Util.Log.LoggerConfig (defaultInteractiveConfiguration)
69-
import Pos.Util.Wlog (LoggerConfig (..), Severity (Debug), WithLogger,
69+
import Pos.Util.Wlog (LoggerConfig (..), Severity (..), WithLogger,
7070
logDebug, logInfo, parseLoggerConfig, removeAllHandlers,
7171
setupLogging)
7272

@@ -243,7 +243,7 @@ getRealLoggerConfig LoggingParams{..} = do
243243
overrideConsoleLog :: LoggerConfig -> LoggerConfig
244244
overrideConsoleLog = case lpConsoleLog of
245245
Nothing -> identity
246-
Just True -> (<>) (defaultInteractiveConfiguration Debug)
246+
Just True -> (<>) (defaultInteractiveConfiguration Info)
247247
-- add output to the console with severity filter >= Info
248248
Just False -> identity
249249

lib/src/Pos/Launcher/Scenario.hs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ import Pos.Infra.Util.LogSafe (logInfoS)
3636
import Pos.Launcher.Resource (NodeResources (..))
3737
import Pos.Util.AssertMode (inAssertMode)
3838
import Pos.Util.CompileInfo (HasCompileInfo, compileInfo)
39-
import Pos.Util.Wlog (LoggerName (..), WithLogger, askLoggerName,
40-
logInfo)
39+
import Pos.Util.Wlog (WithLogger, askLoggerName, logInfo)
4140
import Pos.Worker (allWorkers)
4241
import Pos.WorkMode.Class (WorkMode)
4342

@@ -98,7 +97,7 @@ runNode' genesisConfig NodeResources {..} workers' plugins' = \diffusion -> do
9897
reportHandler (SomeException e) = do
9998
loggerName <- askLoggerName
10099
let msg = "Worker/plugin with logger name "%shown%" failed with exception: "%shown
101-
reportError $ sformat msg (getLoggerName loggerName) e
100+
reportError $ sformat msg loggerName e
102101
exitFailure
103102

104103
-- | Entry point of full node.

networking/cardano-sl-networking.cabal

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,32 +45,33 @@ Library
4545
, async
4646
, attoparsec
4747
, base
48+
, binary >= 0.8
49+
, bytestring
4850
, cardano-sl-chain
4951
, cardano-sl-core
5052
, cardano-sl-util
5153
, containers
52-
, binary >= 0.8
53-
, bytestring
54+
, ekg-core
55+
, formatting
5456
, formatting
5557
, hashable
5658
, kademlia
5759
, lens
5860
, mtl
61+
, mtl >= 2.2.1
5962
, network
6063
, network-transport
6164
, network-transport-tcp
62-
, mtl >= 2.2.1
6365
, random
64-
, universum
6566
, safe-exceptions
6667
, scientific
6768
, stm
6869
, text
6970
, these
70-
, formatting
7171
, time
7272
, time-units
73-
, ekg-core
73+
, universum
74+
, unordered-containers
7475

7576
hs-source-dirs: src
7677
default-language: Haskell2010

pkgs/default.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16843,6 +16843,7 @@ license = stdenv.lib.licenses.mit;
1684316843
, time
1684416844
, time-units
1684516845
, universum
16846+
, unordered-containers
1684616847
, vector
1684716848
}:
1684816849
mkDerivation {
@@ -16887,6 +16888,7 @@ these
1688716888
time
1688816889
time-units
1688916890
universum
16891+
unordered-containers
1689016892
];
1689116893
executableHaskellDepends = [
1689216894
async

tools/src/launcher/Main.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ main =
323323
, _lhSecurityLevel=Just PublicLogLevel}] ++ xs)) .
324324
set ltMinSeverity Info
325325
logException loggerName . usingLoggerName loggerName $
326-
withConfigurations Nothing Nothing False loConfiguration $ \coreConfig _ _ _ -> do
326+
withConfigurations Nothing Nothing False loConfiguration $ \genesisConfig _ _ _ -> do
327327

328328
-- Generate TLS certificates as needed
329329
generateTlsCertificates loConfiguration loX509ToolPath loTlsPath

util/src/Pos/Util/Log.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ module Pos.Util.Log
55
-- * Logging
66
Severity (..)
77
, LogContext
8-
, LogContextT
98
, LoggingHandler
109
-- * Compatibility
1110
, CanLog (..)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ initializeRotator rotation fdesc = do
109109
return stdout -- fallback to standard output in case of exception
110110
hSetBuffering hdl LineBuffering
111111
cursize <- hFileSize hdl
112-
let rottime = addUTCTime (fromInteger $ maxAge * 3600) now
112+
let rottime = addUTCTime (fromInteger $ maxAge * 3600) tsfp
113113
return (hdl, (maxSize - cursize), rottime)
114114
where
115115
fplen = length $ filename fdesc

util/src/Pos/Util/Wlog.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{-# LANGUAGE Rank2Types #-}
22

3-
-- | an interface to 'log-warper'
4-
-- functions and types gradually migrate towards 'katip'
3+
-- | a compatible interface to 'log-warper'
4+
-- logging output is directed to 'katip'
55

66
module Pos.Util.Wlog
77
( -- * CanLog

util/src/Pos/Util/Wlog/Compatibility.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ instance CanLog IO where
9090
case mayEnv of
9191
Nothing -> error "logging not yet initialized. Abort."
9292
Just env -> Log.logItem' ()
93-
(K.Namespace [name])
93+
(K.Namespace (T.split (=='.') name))
9494
env
9595
Nothing
9696
(Internal.sev2klog severity)
@@ -284,7 +284,7 @@ logItemS lhandler a ns loc sev cond msg = do
284284

285285
logMCond :: MonadIO m => LoggerName -> Severity -> Text -> SelectionMode -> m ()
286286
logMCond name severity msg cond = do
287-
let ns = K.Namespace [name]
287+
let ns = K.Namespace (T.split (=='.') name)
288288
lh <- liftIO $ readMVar loggingHandler
289289
logItemS lh () ns Nothing (Internal.sev2klog severity) cond $ K.logStr msg
290290

0 commit comments

Comments
 (0)