summaryrefslogtreecommitdiff
path: root/Jennisys/Logger.fs
blob: 2801354d9bab7d15689072ef96ec5ed8ede2d7e6 (plain)
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
30
31
32
33
34
35
36
37
38
39
40
41
//  #######################################################
///   Simple logging facility
///
///   author: Aleksandar Milicevic (t-alekm@microsoft.com)
//  #######################################################

module Logger

open Printer

let _ALL = 100
let _TRACE = 90
let _DEBUG = 70
let _INFO = 50
let _WARN = 40
let _ERROR = 20
let _NONE = 0

let logLevel = _ALL

let Log level msg =
  if logLevel >= level then
    printf "%s" msg

let LogLine level msg = 
  Log level (msg + newline)

let Trace msg = Log _TRACE msg
let TraceLine msg = LogLine _TRACE msg

let Debug msg = Log _DEBUG msg
let DebugLine msg = LogLine _DEBUG msg

let Info msg = Log _INFO msg
let InfoLine msg = LogLine _INFO msg

let Warn msg = Log _WARN msg
let WarnLine msg = LogLine _WARN msg

let Error msg = Log _ERROR msg
let ErrorLine msg = LogLine _ERROR msg