Changeset 13934 in project


Ignore:
Timestamp:
03/26/09 02:40:23 (10 years ago)
Author:
Kon Lovett
Message:

Updated.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/3/logging/notes.txt

    r9025 r13934  
    1010- External Notation One
    1111
    12 stream          : channel
    13                 | ( channel stream )
    14                 | ( 'not stream )
    15                 | ( 'seq stream )
    16                 | ( 'alt stream )
    17 
    18 channel         : functioncall
     12<stream>        : <channel>
     13                | ( <channel> <stream> )
     14                | ( not <stream> )
     15                | ( seq <stream> )
     16                | ( alt <stream> )
     17
     18<channel>       : <function call>
    1919
    2020There is an implicit 'alt' at the toplevel.
    2121
    22 (define-log example-log
    23   "A slightly silly example of a log definition"
     22(define-log example-log "A slightly silly example of a log definition"
     23  ;
    2424  ((level foo bar)
    2525    (seq (console) (syslog "foo") ) )
     26  ;
    2627  ((level debug)
    2728    ((prefix (srfi-19-date-format "[%d-%m-%Y/%H:%M:%S] " (current-date)))
    2829      ((buffer #:size 16384)
    2930        (file "foo.log" #:mode truncate))))
     31  ;
    3032  ((level error)
    31     ((prefix timestamp " " level " " (? source " ") pid)
     33    ((prefix timestamp #\space level #\space (? source #\space) pid)
    3234      (syslog "foo" #:facility user #:host "syslog.example.com")))
     35  ;
    3336  ((level panic)
    34     (smtp "mail.example.com" "foo@example.com")) )
     37    (smtp "mail.example.com#\spacefoo@example.com")) )
    3538
    3639- External Notation Two
    3740
    38 stream          : channel
    39                 | channel -> stream
    40                 | ~ channel -> stream
    41                 | channel & stream
    42                 | channel : stream
    43 
    44 channel         : ( identifier parameters )
    45 
    46 parameter       : object
    47                 | identifier = object
    48 
    49 parameters      : parameter parameters
    50 
    51 (define-log example-log
    52   "A slightly silly example of a log definition"
     41<stream>        : <channel>
     42                | <channel> -> <stream>
     43                | ~ <channel> -> <stream>
     44                | <channel> & <stream>
     45                | <channel> : <stream>
     46                | ( <stream> )
     47
     48<channel>       : ( <identifier> <parameters> )
     49
     50<parameters>    : <parameter> <parameters>
     51
     52<parameter>     : <object>
     53                | <identifier> = <object>
     54
     55(define-log example-log "A slightly silly example of a log definition"
     56  ;
    5357  (level foo bar)
    5458    -> (console) & (syslog "foo")
     
    6064  :
    6165  (level error)
    62     -> (prefix timestamp " " level " " (? source " ") pid)
     66    -> (prefix timestamp #\space level #\space (? source #\space) pid)
    6367      -> (syslog "foo" facility = user host = "syslog.example.com")
    6468  :
    6569  (level panic)
    66     -> (smtp "mail.example.com" "foo@example.com") )
     70    -> (smtp "mail.example.com#\spacefoo@example.com") )
    6771
    6872; Log a message using the example
     
    8286
    8387  ((exn log) conditions ({condition} ...))
    84    
     88
    8589A log is a channel stream. Channels are divided into filters (interior node)
    8690& outputs (leaf node). Some filters perform flow control.
     
    99103
    100104neg  ; continue downstream on failure
    101   stream       
     105  stream
    102106
    103107asynchronous  ; in own thread
    104108  stream      ;
    105   [quantum]   ; 
     109  [quantum]   ;
    106110  [error]     ; error procedure
    107111
     
    158162  pathanme        ; pathname object or string
    159163  [mode]          ; append | truncate
    160   [permissions]   ; 
     164  [permissions]   ;
    161165  [jitter]        ; # of writes before reopen
    162166  [monitor]       ; # of seconds between checking file non-existence & reopen
     
    173177  [facility]   ; default is user
    174178  [host]       ; hostname | hostname:port
    175   [port]       
     179  [port]
    176180
    177181smtp  ; e-mail message
     
    228232  name          ; symbol
    229233  description   ; string
    230   action        ; procedure (-> [parameter ...] string) 
     234  action        ; procedure (-> [parameter ...] string)
    231235
    232236- Log
     
    268272---------
    269273
    270 - Use of Chicken namespace is provisional.
    271 
    272274- The syntax expanded example
    273275
    274276(define example-log
    275   (##log#create
    276     "A slightly silly example of a log definition"
    277     (##log#alt
    278       ((##log#level '= 'foo 'bar)
    279         (##log#seq (##log#console) (##log#syslog "foo") ) )
    280       ((##log#level '= 'debug)
    281         ((##log#prefix (lambda () (srfi-19-date-format "[%d-%m-%Y/%H:%M:%S] " (current-date))))
    282           ((##log#buffer #:size 16384)
    283             (##log#file "foo.log" #:mode 'truncate) ) ) )
    284       ((##log#level '= 'error)
    285         ((##log#prefix (##log#field 'timestamp) " " (##log#field 'level) " " (##log#field-conditional (##log#field 'source) " ") (##log#field 'pid))
    286           (##log#syslog "foo" #:facility 'user #:host "syslog.example.com") ) )
    287       ((##log#level '= 'panic)
    288         (##log#smtp "mail.example.com" "foo@example.com")) )
    289     #:definition
    290       "((level foo bar) -> (console) & (syslog \"foo\") : (level debug) -> (prefix (srfi-19-date-format \"[%d-%m-%Y/%H:%M:%S] \" (current-date))) -> (buffer size = 16384) -> (file \"foo.log\" mode = truncate) : (level error) -> (prefix timestamp \" \" level \" \" (? source \" \") pid) -> (syslog \"foo\" facility = user host = \"syslog.example.com\") : (level panic) -> (smtp \"mail.example.com\" \"foo@example.com\"))" ) )
     277  (log#make "A slightly silly example of a log definition"
     278    ;
     279    #:definition "((level foo bar) -> (console) & (syslog \"foo\") : (level debug) -> (prefix (srfi-19-date-format \"[%d-%m-%Y/%H:%M:%S] \" (current-date))) -> (buffer size = 16384) -> (file \"foo.log\" mode = truncate) : (level error) -> (prefix timestamp \" \" level \" \" (? source \" \") pid) -> (syslog \"foo\" facility = user host = \"syslog.example.com\") : (level panic) -> (smtp \"mail.example.com\" \"foo@example.com\"))"
     280    ;
     281    (log#alt
     282      ;
     283      ((log#level 'foo 'bar)
     284        (log#seq (log#console) (log#syslog "foo") ) )
     285      ;
     286      ((log#level 'debug)
     287        ((log#prefix (lambda () (srfi-19-date-format "[%d-%m-%Y/%H:%M:%S] " (current-date))))
     288          ((log#buffer #:size 16384)
     289            (log#file "foo.log" #:mode 'truncate) ) ) )
     290      ;
     291      ((log#level 'error)
     292        ((log#prefix (log#field 'timestamp) #\space (log#field 'level) #\space (log#field-conditional (log#field 'source) #\space) (log#field 'pid))
     293          (log#syslog "foo" #:facility 'user #:host "syslog.example.com") ) )
     294      ;
     295      ((log#level 'panic)
     296        (log#smtp "mail.example.com#\spacefoo@example.com")) ) ) )
    291297
    292298
     
    296302
    297303  AND
    298  
     304
    299305~ (match ...) -> (output ...)
    300306
    301307  =>
    302308
    303 ((##log#neg (##log#match ...)) (##log#output))
     309((log#neg (log#match ...)) (log#output))
    304310
    305311-
Note: See TracChangeset for help on using the changeset viewer.