1
+ -- myapp.lua --
2
+ local audit = require (' audit' )
3
+
4
+ -- Log message string
5
+ audit .log (' Hello, Alice!' )
6
+ -- Log format string and arguments
7
+ audit .log (' Hello, %s!' , ' Bob' )
8
+ -- Log table with audit log field values
9
+ audit .log ({type = ' custom_hello' , description = ' Hello, World!' })
10
+ audit .log ({type = ' custom_farewell' , user = ' eve' , module = ' custom' , description = ' Farewell, Eve!' })
11
+ -- Create a new log module
12
+ local my_audit = audit .new ({type = ' custom_hello' , module = ' my_module' })
13
+ my_audit :log (' Hello, Alice!' )
14
+ my_audit :log ({tag = ' admin' , description = ' Hello, Bob!' })
15
+ -- Log 'Hello!' message with the VERBOSE severity level
16
+ audit .log ({severity = ' VERBOSE' , description = ' Hello!' })
17
+
18
+ -- Log 'Hello!' message with a shortcut helper function
19
+ audit .verbose (' Hello!' )
20
+
21
+ -- Like audit.log(), a shortcut helper function accepts a table of options
22
+ audit .verbose ({description = ' Hello!' })
23
+
24
+ -- Severity levels are available for custom loggers
25
+ local my_logger = audit .new ({module = ' my_module' })
26
+ my_logger :log ({severity = ' ALARM' , description = ' Alarm' })
27
+ my_logger :alarm (' Alarm' )
28
+
29
+ -- Overwrite session_type and remote fields
30
+ audit .log ({type = ' custom_hello' , description = ' Hello!' ,
31
+ session_type = ' my_session' , remote = ' my_remote' })
0 commit comments