1-- Copyright (c) 2019 The DAML Authors. All rights reserved.
2-- SPDX-License-Identifier: Apache-2.0
4{-# LANGUAGE RankNTypes #-}
5-- | This is a compatibility module that abstracts over the
6-- concrete choice of logging framework so users can plug in whatever
7-- framework they want to.
8module Development.IDE.Types.Logger
11 , logError, logWarning, logInfo, logDebug
15import qualified Data.Text as T
19-- Don't change the ordering of this type or you will mess up the Ord
21 = Debug -- ^ Verbose debug logging.
22 | Info -- ^ Useful information in case an error has to be understood.
24 -- ^ These error messages should not occur in a expected usage, and
25 -- should be investigated.
26 | Error -- ^ Such log messages must never occur in expected usage.
27 deriving (Eq, Show, Ord, Enum, Bounded)
30-- | Note that this is logging actions _of the program_, not of the user.
31-- You shouldn't call warning/error if the user has caused an error, only
32-- if our code has gone wrong and is itself erroneous (e.g. we threw an exception).
33data Logger = Logger {logPriority :: Priority -> T.Text -> IO ()}
36logError :: Logger -> T.Text -> IO ()
37logError x = logPriority x Error
39logWarning :: Logger -> T.Text -> IO ()
40logWarning x = logPriority x Warning
42logInfo :: Logger -> T.Text -> IO ()
43logInfo x = logPriority x Info
45logDebug :: Logger -> T.Text -> IO ()
46logDebug x = logPriority x Debug
50noLogging = Logger $ \_ _ -> return ()
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list