shrun-0.9: A utility program for running shell commands concurrently.
Safe HaskellNone
LanguageGHC2021

Shrun.Logging

Contents

Description

Provides logging functionality. This is a high-level picture of how logging works:

  1. Shrun.IO sends logs per command based on the environment (i.e. is file logging on and/or do we log commands). If any logs are produced, they are formatted and sent directly to a queue.
  2. Shrun also produces logs. These are "higher-level" e.g. success/failure status of a given command, fatal errors, etc. Shrun uses the functions here (e.g. putRegionLog) that handles deciding if a given log should be written to eitherboth of the consolefile log queues.
  3. Shrun has two threads -- one for each queue -- that poll their respective queues and writes logs as they are found. These do no environment checking; any logs that make it to the queue are eventually written.
Synopsis

Writing logs

putRegionLog Source #

Arguments

:: (HasCallStack, HasCommonLogging env, HasConsoleLogging env (Region m), HasFileLogging env, MonadReader env m, MonadSTM m, MonadTime m) 
=> Region m

Region.

-> Log

Log to send.

-> m () 

Unconditionally writes a log to the console queue. Conditionally writes the log to the file queue, if Logging's fileLogging is present.

regionLogToConsoleQueue Source #

Arguments

:: (HasCallStack, HasCommonLogging env, HasConsoleLogging env (Region m), MonadReader env m, MonadSTM m) 
=> Region m

Region.

-> Log

Log to send.

-> m () 

Writes the log to the console queue.

logToFileQueue Source #

Arguments

:: (HasCallStack, MonadSTM m, MonadTime m) 
=> KeyHideSwitch

How to display the command.

-> FileLoggingEnv

FileLogging config.

-> Log

Log to send.

-> m () 

Writes the log to the file queue.