1
1
-- Copyright (c) 2019 The DAML Authors. All rights reserved.
2
2
-- SPDX-License-Identifier: Apache-2.0
3
- {-# LANGUAGE CPP #-}
4
- {-# LANGUAGE RecordWildCards #-}
5
- {-# LANGUAGE TemplateHaskell #-}
6
- {-# LANGUAGE TupleSections #-}
3
+ {-# LANGUAGE CPP #-}
4
+ {-# LANGUAGE RecordWildCards #-}
5
+ {-# LANGUAGE TemplateHaskell #-}
6
+ {-# LANGUAGE TupleSections #-}
7
7
{-# OPTIONS_GHC -Wno-dodgy-imports #-} -- GHC no longer exports def in GHC 8.6 and above
8
+ {-# LANGUAGE TypeApplications #-}
8
9
9
10
module Ide.Arguments
10
11
( Arguments (.. )
@@ -19,6 +20,7 @@ module Ide.Arguments
19
20
import Data.Version
20
21
import Development.IDE (IdeState )
21
22
import Development.IDE.Main (Command (.. ), commandP )
23
+ import Development.IDE.Types.Logger (Priority (.. ))
22
24
import GitHash (giHash , tGitInfoCwdTry )
23
25
import Ide.Types (IdePlugins )
24
26
import Options.Applicative
@@ -43,10 +45,9 @@ data GhcideArguments = GhcideArguments
43
45
,argsShakeProfiling :: Maybe FilePath
44
46
,argsTesting :: Bool
45
47
,argsExamplePlugin :: Bool
46
- -- These next two are for compatibility with existing hie clients, allowing
47
- -- them to just change the name of the exe and still work.
48
- , argsDebugOn :: Bool
48
+ , argsLogLevel :: Priority
49
49
, argsLogFile :: Maybe String
50
+ -- ^ the minimum log level to show
50
51
, argsThreads :: Int
51
52
, argsProjectGhcVersion :: Bool
52
53
} deriving Show
@@ -122,13 +123,23 @@ arguments plugins = GhcideArguments
122
123
<*> switch (long " example"
123
124
<> help " Include the Example Plugin. For Plugin devs only" )
124
125
125
- <*> switch
126
- ( long " debug"
126
+ <*>
127
+ (option @ Priority auto
128
+ (long " log-level"
129
+ <> help " Only show logs at or above this log level"
130
+ <> metavar " LOG_LEVEL"
131
+ <> value Info
132
+ <> showDefault
133
+ )
134
+ <|>
135
+ flag' Debug
136
+ (long " debug"
127
137
<> short ' d'
128
- <> help " Generate debug output"
129
- )
138
+ <> help " Sets the log level to Debug, alias for '--log-level Debug'"
139
+ )
140
+ )
130
141
<*> optional (strOption
131
- ( long " logfile"
142
+ (long " logfile"
132
143
<> short ' l'
133
144
<> metavar " LOGFILE"
134
145
<> help " File to log to, defaults to stdout"
0 commit comments