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

Commit 0d63a1e

Browse files
committed
[GH-345] Added the logsPrefix from configuration.
1 parent f66d93c commit 0d63a1e

File tree

2 files changed

+23
-20
lines changed

2 files changed

+23
-20
lines changed

cardano-launcher/app/Main.hs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -105,27 +105,7 @@ main = silence $ do
105105
-- Otherwise run the real deal, the real function.
106106
runDefaultUpdateProcess filePath arguments
107107

108-
109-
-- the log output path (TODO: get base path from configuration)
110-
logfilepath <- pure "Logs/launcher"
111-
112108
logConfig <- defaultConfigStdout
113-
scribes0 <- CM.getSetupScribes logConfig
114-
CM.setSetupScribes logConfig $ scribes0 <>
115-
[ScribeDefinition {
116-
scName = logfilepath,
117-
scFormat = ScText,
118-
scKind = FileSK,
119-
scPrivacy = ScPublic,
120-
scRotation = Just $ RotationParameters
121-
{
122-
rpLogLimitBytes = 10000000,
123-
rpMaxAgeHours = 24,
124-
rpKeepFilesNum = 3
125-
}
126-
}]
127-
CM.setDefaultScribes logConfig [ "StdoutSK::text"
128-
, "FileSK::" <> logfilepath ]
129109

130110
-- A safer way to close the tracing.
131111
withTrace logConfig "launcher" $ \baseTrace -> do
@@ -151,6 +131,26 @@ main = silence $ do
151131
throwM $ LauncherOptionsError (show err)
152132
Right lo -> pure lo
153133

134+
-- the log output path (TODO: get base path from configuration)
135+
let logfilepath = lologsPrefix launcherOptions <> "Logs/launcher"
136+
137+
scribes0 <- CM.getSetupScribes logConfig
138+
CM.setSetupScribes logConfig $ scribes0 <>
139+
[ScribeDefinition {
140+
scName = toS logfilepath,
141+
scFormat = ScText,
142+
scKind = FileSK,
143+
scPrivacy = ScPublic,
144+
scRotation = Just $ RotationParameters
145+
{
146+
rpLogLimitBytes = 10000000,
147+
rpMaxAgeHours = 24,
148+
rpKeepFilesNum = 3
149+
}
150+
}]
151+
CM.setDefaultScribes logConfig [ "StdoutSK::text"
152+
, "FileSK::" <> toS logfilepath ]
153+
154154
let lockFile = loStateDir launcherOptions <> "/daedalus_lockfile"
155155
Trace.logNotice baseTrace $ "Locking file so that multiple applications won't run at same time"
156156
-- Check if it's locked or not. Will throw an exception if the

cardano-launcher/src/Cardano/Shell/Configuration.hs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ data LauncherOptions = LauncherOptions
5050
, loWorkingDirectory :: !FilePath
5151
, loStateDir :: !FilePath
5252
-- On WIN it should set this directory as current.
53+
, lologsPrefix :: !FilePath
5354
} deriving (Show, Generic)
5455

5556
instance FromJSON LauncherOptions where
@@ -63,6 +64,7 @@ instance FromJSON LauncherOptions where
6364
tlsPath <- o .:? "tlsPath"
6465
workingDir <- o .: "workingDir"
6566
stateDir <- o .: "stateDir"
67+
logsPrefix <- o .: "logsPrefix"
6668

6769
pure $ LauncherOptions
6870
configuration
@@ -73,6 +75,7 @@ instance FromJSON LauncherOptions where
7375
daedalusBin
7476
workingDir
7577
stateDir
78+
logsPrefix
7679

7780
-- | Configuration yaml file location and the key to use. The file should
7881
-- parse to a MultiConfiguration and the 'cfoKey' should be one of the keys

0 commit comments

Comments
 (0)