package env_config

  1. Overview
  2. Docs
Helper library for retrieving configuration from an environment variable

Install

dune-project
 Dependency

Authors

Maintainers

Sources

env_config-v0.16.0.tar.gz
sha256=f32ec330701f5896c60dd77709b183749c6fed654ad5b2a41d907dcf5d931c83

doc/src/env_config/simple_log_output.ml.html

Source file simple_log_output.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
module Stable = struct
  open Core.Core_stable

  module V1 = struct
    module Format = Async.Log.Output.Format.Stable.V1

    type t =
      | Stdout
      | Stderr
      | File of
          { format : Format.t
          ; filename : string
          }
    [@@deriving sexp]
  end
end

open Core
open Async
include Stable.V1

let stdout = lazy (Log.Output.writer `Sexp (force Writer.stdout))
let stderr = lazy (Log.Output.writer `Sexp (force Writer.stderr))

let to_output = function
  | Stdout -> Lazy.force stdout
  | Stderr -> Lazy.force stderr
  | File { format; filename } -> Log.Output.file format ~filename
;;