CAEN MCA  0.99.10
SDK for Hexagon
LOGGING.md
Go to the documentation of this file.
1 # Logging system{#logging}
2 \tableofcontents
3 
4 # Filename
5 By default, i.e. if no error occours when loading the CAEN libraries, the output is written
6 in a file named CAENMCALog.txt, that is created in the current directory.
7 In case of error, the file name could be different.
8 
9 To change the default file, you may set the environmental variable
10 ``` bash
11 CAEN_LOG_FILENAME = <filename>
12 ```
13 to force the output to a file of your choice.
14 If you want the output to be printed in the
15 standard output, use the special files of your system:
16 ``` bash
17 CAEN_LOG_FILENAME = /dev/stdout # Linux
18 CAEN_LOG_FILENAME = CON # Windows
19 ```
20 
21 # Levels
22 The log supports 5 levels:
23 * level **0**: `OFF` (intended to turn off logging)
24 * level **1**: `ERROR`
25 * level **2**: `WARNING`
26 * level **3**: `INFO`
27 * level **4**: `DEBUG`
28 
29 By default, all the levels are printed. To change the default file, you may set the environmental variable
30 ``` bash
31 CAEN_LOG_LEVEL = <level number>
32 ```
33 
34 to set the level to **M**. A log request of level **N** in a logger
35 with level set to **N** will be enabled if **N <= M**.
36 
37 # Output format
38 The log will consist of lines in the form
39 
40 ```
41 [<seconds since start (12 chars, 3 decimal)>][<severity (2 chars)>][<source file>]: <Message>
42 ```
43 
44 Wher the severity is `EE` for `ERROR`, `WW` for `WARNING`, and so on.
45 For example, these should be the beginning of log with successful connection to a device.
46 
47 ```
48 [ 0.303][II][CAENMCA.c]: Socket created.
49 [ 0.304][II][CAENMCA.c]: Connected to 'localhost:56342'.
50 ```