module GHC.Driver.Config.Logger
  ( initLogFlags
  )
where

import GHC.Prelude

import GHC.Driver.Session

import GHC.Utils.Logger (LogFlags (..))
import GHC.Utils.Outputable

-- | Initialize LogFlags from DynFlags
initLogFlags :: DynFlags -> LogFlags
initLogFlags :: DynFlags -> LogFlags
initLogFlags DynFlags
dflags = LogFlags
  { log_default_user_context :: SDocContext
log_default_user_context = DynFlags -> PprStyle -> SDocContext
initSDocContext DynFlags
dflags PprStyle
defaultUserStyle
  , log_default_dump_context :: SDocContext
log_default_dump_context = DynFlags -> PprStyle -> SDocContext
initSDocContext DynFlags
dflags PprStyle
defaultDumpStyle
  , log_dump_flags :: EnumSet DumpFlag
log_dump_flags           = DynFlags -> EnumSet DumpFlag
dumpFlags DynFlags
dflags
  , log_show_caret :: Bool
log_show_caret           = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_DiagnosticsShowCaret DynFlags
dflags
  , log_show_warn_groups :: Bool
log_show_warn_groups     = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_ShowWarnGroups DynFlags
dflags
  , log_enable_timestamps :: Bool
log_enable_timestamps    = Bool -> Bool
not (GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_SuppressTimestamps DynFlags
dflags)
  , log_dump_to_file :: Bool
log_dump_to_file         = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_DumpToFile DynFlags
dflags
  , log_dump_dir :: Maybe FilePath
log_dump_dir             = DynFlags -> Maybe FilePath
dumpDir DynFlags
dflags
  , log_dump_prefix :: FilePath
log_dump_prefix          = DynFlags -> FilePath
dumpPrefix DynFlags
dflags
  , log_dump_prefix_override :: Maybe FilePath
log_dump_prefix_override = DynFlags -> Maybe FilePath
dumpPrefixForce DynFlags
dflags
  , log_with_ways :: Bool
log_with_ways            = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_DumpWithWays DynFlags
dflags
  , log_enable_debug :: Bool
log_enable_debug         = Bool -> Bool
not (DynFlags -> Bool
hasNoDebugOutput DynFlags
dflags)
  , log_verbosity :: Int
log_verbosity            = DynFlags -> Int
verbosity DynFlags
dflags
  , log_ways :: Maybe Ways
log_ways                 = forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ DynFlags -> Ways
ways DynFlags
dflags
  }