|
@@ -20,6 +20,34 @@ single text file.
|
20
|
20
|
|
21
|
21
|
API to make usage of *htlog.cgi* in Perl scripts even easier
|
22
|
22
|
|
|
23
|
+ use htlogr;
|
|
24
|
+
|
|
25
|
+ my $logger = htlogr::new('http://192.168.1.1/cgi-bin/htlog.cgi');
|
|
26
|
+
|
|
27
|
+ # we don't need tag nor iteration number, but it can be useful
|
|
28
|
+ my $tag = "synopsis_test";
|
|
29
|
+
|
|
30
|
+ $logger->log("Commencing synopsis test", $tag);
|
|
31
|
+
|
|
32
|
+ my $data = {
|
|
33
|
+ foo => 1,
|
|
34
|
+ bar => "Hello world"
|
|
35
|
+ };
|
|
36
|
+
|
|
37
|
+ foreach my $i (1..1000) {
|
|
38
|
+
|
|
39
|
+ # log normal messages--with I!
|
|
40
|
+ $logger->log("next 10 done!", $tag, $i) unless ($num % 100);
|
|
41
|
+
|
|
42
|
+ # or a simple one-level data structures
|
|
43
|
+ $logger->data(
|
|
44
|
+ my_func_returning_hashref($data),
|
|
45
|
+ $tag,
|
|
46
|
+ $i
|
|
47
|
+ );
|
|
48
|
+
|
|
49
|
+ }
|
|
50
|
+
|
23
|
51
|
|
24
|
52
|
##autotest.pl##
|
25
|
53
|
|