Bolt
 
    Introduction     Status     Example     Manual     API     Downloads      
         
 

Configuration   
Compilation   
Source   
Result   

 
Configuration
The following configuration file is used in the example (old format):
level=trace
filter=all
layout=default
mode=direct
output=file
name=log


When using the new format, the same configuration is written:
logger "" {
  level=trace;
  filter=all;
  layout=default;
  mode=direct;
  output=file;
  name="log";
}

Compilation
The following Makefile is used to compile, and run the example (when using the new configuration format, "BOLT_FILE" should be replaced with "BOLT_CONFIG"):
DEPENDENCIES=unix.cma dynlink.cma

default: clean compile run

clean:
	rm -f *.cm* log bytecode

compile:
	ocamlc -c -I +bolt bolt.cma \
	    -pp 'camlp4o /usr/local/lib/ocaml/bolt/bolt_pp.cmo' source.ml
	ocamlc -o bytecode -I +bolt $(DEPENDENCIES) bolt.cma source.cmo

run:
	BOLT_FILE=config ./bytecode

Source
The following source file shows how to use simple LOG statements:
let funct n =
  LOG "funct(%d)" n LEVEL DEBUG;
  for i = 1 to n do
    print_endline "..."
  done

let () =
  LOG "application start" LEVEL TRACE;
  funct 3;
  funct 7;
  LOG "application end" LEVEL TRACE

Result
When executed, the example may produce various traces, according to the layout chosen in the configuration file:
[
default ] [ html ] [ simple ] [ xml ]

It is also possible to define layouts from scratch (in OCaml code), or CSV or text layouts based on $(...) substitution (in configuration file).