Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Fredrik Wieczerkowski
curry-tools
Commits
159d1e26
Commit
159d1e26
authored
Nov 04, 2017
by
Michael Hanus
Browse files
CPM updated
parent
02cb7922
Changes
2
Hide whitespace changes
Inline
Side-by-side
cpm/src/CPM/ErrorLogger.curry
View file @
159d1e26
...
...
@@ -38,7 +38,8 @@ logLevelOf :: LogEntry -> LogLevel
logLevelOf (LogEntry ll _) = ll
--- A log level.
data LogLevel = Info
data LogLevel = Quiet
| Info
| Debug
| Error
| Critical
...
...
@@ -141,6 +142,7 @@ showLogEntry (LogEntry lvl msg) = do
else return ()
where
lvlText = case lvl of
Quiet -> text "QUIET " -- show not occur...
Info -> text "INFO "
Debug -> green $ text "DEBUG "
Critical -> red $ text "CRITICAL "
...
...
@@ -149,19 +151,28 @@ showLogEntry (LogEntry lvl msg) = do
--- Compares two log levels.
levelGte :: LogLevel -> LogLevel -> Bool
levelGte Debug Debug = True
levelGte Debug Quiet = False
levelGte Debug Info = False
levelGte Debug Error = False
levelGte Debug Critical = False
levelGte Info Debug = True
levelGte Info Info = True
levelGte Info Quiet = False
levelGte Info Error = False
levelGte Info Critical = False
levelGte Quiet Debug = True
levelGte Quiet Quiet = True
levelGte Quiet Info = False
levelGte Quiet Error = False
levelGte Quiet Critical = False
levelGte Error Debug = True
levelGte Error Info = True
levelGte Error Quiet = True
levelGte Error Error = True
levelGte Error Critical = True
levelGte Critical Debug = True
levelGte Critical Info = True
levelGte Critical Quiet = True
levelGte Critical Error = True
levelGte Critical Critical = True
...
...
cpm/src/CPM/Main.curry
View file @
159d1e26
...
...
@@ -309,6 +309,7 @@ readLogLevel :: String -> Either String LogLevel
readLogLevel s = case map toLower s of
"debug" -> Right Debug
"info" -> Right Info
"quiet" -> Right Quiet
_ -> Left $ "Illegal verbosity value: " ++ s
readRcOption :: String -> Either String (String,String)
...
...
@@ -341,10 +342,10 @@ a >.> f = case a of
optionParser :: [String] -> ParseSpec (Options -> Either String Options)
optionParser allargs = optParser
( option (\s a -> readLogLevel s >.> \ll -> a { optLogLevel = ll })
( long "verbosity"
<> short "v"
<> metavar "LEVEL"
<> help "Log level for the application. Valid values
are 'info' and 'debug'.
" )
( long "verbosity"
<> short "v"
<> metavar "LEVEL"
<> help "Log level for the application. Valid values
: info|debug|quiet
" )
<.> option (\s a -> readRcOption s >.> \kv ->
a { optDefConfig = optDefConfig a ++ [kv] })
( long "define"
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment