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

Commit a45c6d2

Browse files
committed
Revert "[#345] logging configuration for logging to file (#350)"
This reverts commit 975e880.
1 parent fd52607 commit a45c6d2

File tree

4 files changed

+14
-44
lines changed

4 files changed

+14
-44
lines changed

cardano-launcher/app/Main.hs

Lines changed: 14 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,11 @@ module Main where
88
import Cardano.Prelude hiding (option)
99
import qualified Prelude
1010

11-
import Control.Exception.Safe (throwM)
12-
1311
-- Yes, we should use these seldomly but here it seems quite acceptable.
1412
import Data.IORef (newIORef, readIORef, writeIORef)
1513
import Data.Text.Lazy.Builder (fromString, fromText)
1614

1715
import Distribution.System (OS (Windows), buildOS)
18-
19-
import System.FilePath ((</>))
2016
import System.Environment (setEnv)
2117
import System.Exit (exitWith)
2218
import System.IO.Silently (hSilence)
@@ -29,9 +25,6 @@ import Options.Applicative (Parser, ParserInfo, auto, execParser,
2925
fullDesc, header, help, helper, info,
3026
long, metavar, option, optional, progDesc)
3127

32-
import qualified Cardano.BM.Configuration.Model as CM
33-
import Cardano.BM.Data.Output
34-
import Cardano.BM.Data.Rotation
3528
import Cardano.BM.Setup (withTrace)
3629
import qualified Cardano.BM.Trace as Trace
3730
import Cardano.BM.Tracing
@@ -47,10 +40,12 @@ import Cardano.Shell.Launcher (LoggingDependencies (..), TLSError,
4740
TLSPath (..), WalletRunner (..),
4841
generateTlsCertificates, runLauncher,
4942
walletRunnerProcess)
50-
import Cardano.Shell.Launcher.Types (nullLogging)
5143
import Cardano.Shell.Update.Lib (UpdaterData (..),
5244
runDefaultUpdateProcess)
5345
import Cardano.X509.Configuration (TLSConfiguration)
46+
import Control.Exception.Safe (throwM)
47+
48+
import System.FilePath ((</>))
5449

5550
--------------------------------------------------------------------------------
5651
-- Main
@@ -77,7 +72,7 @@ main = silence $ do
7772

7873
-- This function either stubs out the wallet exit code or
7974
-- returns the "real" function.
80-
let walletExecutionFunction =
75+
let walletExectionFunction =
8176
WalletRunner $ \daedalusBin walletArguments -> do
8277
-- Check if we have any exit codes remaining.
8378
stubExitCodes <- readIORef walletTestExitCodesMVar
@@ -109,37 +104,8 @@ main = silence $ do
109104
-- Otherwise run the real deal, the real function.
110105
runDefaultUpdateProcess filePath arguments
111106

112-
-- We get the launcher options. We don't log them currently because of the cat-mouse deps.
113-
launcherOptions <- do
114-
eLauncherOptions <- getLauncherOptions nullLogging (launcherConfigPath launcherCLI)
115-
case eLauncherOptions of
116-
Left err -> do
117-
putTextLn $
118-
"Error occured while parsing configuration file: " <> show err
119-
throwM $ LauncherOptionsError (show err)
120-
Right lo -> pure lo
121107

122108
logConfig <- defaultConfigStdout
123-
let logfilepath = lologsPrefix launcherOptions </> "launcher"
124-
125-
-- We configure the logging to be on stdout and in the file as well.
126-
CM.setSetupScribes logConfig
127-
[ScribeDefinition {
128-
scName = toS logfilepath,
129-
scFormat = ScText,
130-
scKind = FileSK,
131-
scPrivacy = ScPublic,
132-
scRotation = Just $ RotationParameters
133-
{ rpLogLimitBytes = 10000000
134-
, rpMaxAgeHours = 24
135-
, rpKeepFilesNum = 3
136-
}
137-
}]
138-
139-
CM.setDefaultScribes logConfig
140-
[ "StdoutSK::text"
141-
, "FileSK::" <> toS logfilepath
142-
]
143109

144110
-- A safer way to close the tracing.
145111
withTrace logConfig "launcher" $ \baseTrace -> do
@@ -156,6 +122,15 @@ main = silence $ do
156122
setEnv "LC_ALL" "en_GB.UTF-8"
157123
setEnv "LANG" "en_GB.UTF-8"
158124

125+
launcherOptions <- do
126+
eLauncherOptions <- getLauncherOptions loggingDependencies (launcherConfigPath launcherCLI)
127+
case eLauncherOptions of
128+
Left err -> do
129+
logErrorMessage baseTrace $
130+
"Error occured while parsing configuration file: " <> show err
131+
throwM $ LauncherOptionsError (show err)
132+
Right lo -> pure lo
133+
159134
let lockFile = loStateDir launcherOptions </> "daedalus_lockfile"
160135
Trace.logNotice baseTrace $ "Locking file so that multiple applications won't run at same time"
161136
-- Check if it's locked or not. Will throw an exception if the
@@ -208,7 +183,7 @@ main = silence $ do
208183
-- Finally, run the launcher once everything is set up!
209184
exitCode <- runLauncher
210185
loggingDependencies
211-
walletExecutionFunction
186+
walletExectionFunction
212187
daedalusBin
213188
updaterExecutionFunction
214189
updaterData

cardano-launcher/cardano-launcher.cabal

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ executable cardano-launcher
9090
, optparse-applicative
9191
-- directory
9292
, directory
93-
, filepath
9493

9594
if os(windows)
9695
ghc-options: -optl-mwindows

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ data LauncherOptions = LauncherOptions
5252
, loWorkingDirectory :: !FilePath
5353
, loStateDir :: !FilePath
5454
-- On WIN it should set this directory as current.
55-
, lologsPrefix :: !FilePath
5655
} deriving (Show, Generic)
5756

5857
instance FromJSON LauncherOptions where
@@ -67,7 +66,6 @@ instance FromJSON LauncherOptions where
6766
tlsConfig <- o .:? "tlsConfig"
6867
workingDir <- o .: "workingDir"
6968
stateDir <- o .: "stateDir"
70-
logsPrefix <- o .: "logsPrefix"
7169

7270
pure $ LauncherOptions
7371
configuration
@@ -79,7 +77,6 @@ instance FromJSON LauncherOptions where
7977
daedalusBin
8078
workingDir
8179
stateDir
82-
logsPrefix
8380

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

nix/.stack.nix/cardano-launcher.nix

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)