Commits

jhwoodyatt  committed 66909c6

Add `Notice level and associated methods to basic layer.
Cleared up some ambiguous documentation.

  • Participants
  • Parent commits 78f9155

Comments (0)

Files changed (2)

File cf/cf_journal.ml

     type fail_t = [ `Fail ]
     type error_t = [ `Error ]
     type warn_t = [ `Warn ]
+    type notice_t = [ `Notice ]
     type info_t = [ `Info ]
     type debug_t = [ `Debug ]
     
-    type basic_t = [ invalid_t | fail_t | error_t | warn_t | info_t | debug_t ]
+    type basic_t =
+        [ invalid_t | fail_t | error_t | warn_t | notice_t | info_t | debug_t ]
     type enable_t = [ `None | `All ]
     type level_t = [ basic_t | enable_t ]
 end
         
         method code = function
             | `All -> max_int
-            | `Invalid -> 6000
-            | `Fail -> 5000
-            | `Error -> 4000
-            | `Warn -> 3000
+            | `Invalid -> 7000
+            | `Fail -> 6000
+            | `Error -> 5000
+            | `Warn -> 4000
+            | `Notice -> 3000
             | `Info -> 2000
             | `Debug -> 1000
             | `None -> min_int
             let fail_ = "FAIL" in
             let error_ = "ERROR" in
             let warn_ = "WARN" in
+            let notice_ = "NOTICE" in
             let info_ = "INFO" in
             let debug_ = "DEBUG" in
             function
             | `Fail -> fail_
             | `Error -> error_
             | `Warn -> warn_
+            | `Notice -> notice_
             | `Info -> info_
             | `Debug -> debug_
             | _ -> invalid_arg "Cf_journal: no tag defined for priority!"
         method warn: 'a. ('a, unit, string, unit) format4 -> 'a =
             self#put `Warn ignore
         
+        method notice: 'a. ('a, unit, string, unit) format4 -> 'a =
+            self#put `Notice ignore
+        
         method info: 'a. ('a, unit, string, unit) format4 -> 'a =
             self#put `Info ignore
         
         method private event = new Basic.event basic_prioritizer
     end
 
+type t = Basic.level_t Basic.event Basic.archiver basic_agent
+
 let stdout = new basic_stdio_agent basic_stdout_archiver
 let stderr = new basic_stdio_agent basic_stderr_archiver
 

File cf/cf_journal.mli

     include T with type Priority.t = int
 
     (** The priority level for events indicating that an internal program
-        function has been called with invalid arguments.  Code=6000.
+        function has been called with invalid arguments.  Code=7000.
     *)
     type invalid_t = [ `Invalid ]
 
     (** The priority level for events indicating that an internal program
-        function is undefined for the given arguments.  Code=5000.
+        function has failed, results may have been lost and recovery is not
+        expected.  Code=6000.
     *)
     type fail_t = [ `Fail ]
 
     (** The priority level for events indicating that a program has encountered
-        invalid input.  The program may or may not be able to recover and
-        continue processing further input correctly.  Code=4000.
+        invalid input.  The program is expected to recover and continue
+        processing further valid input correctly.  Code=5000.
     *)
     type error_t = [ `Error ]
 
     (** The priority level for events indicating that a program has encountered
-        unexpected input.  The program is expected to recover and continue
-        processing further input correctly.  Code=3000.
+        unexpected input, indicating that an external process may have failed.
+        The program is expected to continue processing further input normally.
+        Code=4000.
     *)
     type warn_t = [ `Warn ]
 
-    (** The priority level for events indicating significant information about
+    (** The priority level for events indicating exceptional information about
         the processing of the program useful for diagnosing external processes.
         Code=2000.
     *)
+    type notice_t = [ `Notice ]
+
+    (** The priority level for events indicating normal information about the
+        processing of the program useful for diagnosing external processes.
+        Code=2000.
+    *)
     type info_t = [ `Info ]
 
     (** The priority level for events describing internal processing of the
     (** The priority levels corresponding to events that the basic agent has
         public methods for journaling.
     *)
-    type basic_t = [ invalid_t | fail_t | error_t | warn_t | info_t | debug_t ]
+    type basic_t =
+        [ invalid_t | fail_t | error_t | warn_t | notice_t | info_t | debug_t ]
     
     (** Additional priority levels corresponding to limit levels in the basic
         event prioritizer used for completely enabling or disabling all
         *)
         method warn: 'a. ('a, unit, string, unit) format4 -> 'a
 
+        (** Use [a#notice msg ...] to format message text to put to the
+            archivers at the [`Notice] level.
+        *)
+        method notice: 'a. ('a, unit, string, unit) format4 -> 'a
+
         (** Use [a#info msg ...] to format message text to put to the
             archivers at the [`Info] level.
         *)
         method debug: 'a. ('a, unit, string, bool) format4 -> 'a
     end
 
+(** The type of the most basic agent, used for [stdout] and [stderr] below. *)
+type t = Basic.level_t Basic.event Basic.archiver basic_agent
+
 (** A basic agent, initially set with a limit of [`Warn], and with with one
     basic archiver for the [Pervasives.stdout] channel.
 *)
-val stdout: Basic.level_t Basic.event Basic.archiver basic_agent
+val stdout: t
 
 (** A basic agent, initially set with a limit of [`Warn], and with with one
     basic archiver for the [Pervasives.stderr] channel.
 *)
-val stderr: Basic.level_t Basic.event Basic.archiver basic_agent
+val stderr: t
 
 (*--- End of File [ cf_journal.mli ] ---*)