Merge tag 'upstream/3.3.3'
[debian/amanda] / perl / Amanda / Logfile.pod
index 0663f44560dcaca1f92e7e6beb87399eadc7d8ac..01f6fe5e4c0abdf553aaa68965c6c074ed678048 100644 (file)
@@ -1,9 +1,10 @@
 /*
- * Copyright (c) 2009, 2010 Zmanda, Inc.  All Rights Reserved.
+ * Copyright (c) 2009-2012 Zmanda, Inc.  All Rights Reserved.
  *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
@@ -86,20 +87,41 @@ C<$handle>, or nothing at the end of the logfile.
 
 =back
 
-To write a logfile, call C<log_add($logtype, $string)>.  On the first
-call, this function opens and locks C<$logdir/log>; subsequent calls
-just append to this file.  As such, this function is only appropriate
-for situations where C<amlogroll> will be invoked later to rename
-C<$logdir/log> to C<$logdir/log.$timestamp.$n>.
+=head3 Writing a "current" Logfile
+
+To write a logfile, call C<log_add($logtype, $string)>.  On the first call,
+this function opens and locks C<$logdir/log>; subsequent calls just append to
+this file.  As such, this function is only appropriate for situations where
+C<log_rename> will be invoked later to rename C<$logdir/log> to
+C<$logdir/log.$timestamp.$n>.
+
+If you need to write a log entry for another program, for example to simulate
+taper entries, call C<log_add_full($logtype, $pname, $string)>.
 
 All of the functions in this section can be imported by name if
 desired.
 
+=head3 Utilities
+
+Many trace log entries have a statistics entry in what used to be the error
+message slot, of the form C<[sec .. kb .. kps ..]>.  The function C<make_stats>
+will create such an entry for you:
+
+    make_stats($size, $duration, $orig_kb);
+
+Note that C<$orig_kb> can be undefined, in which case it will not appear in
+the statistics output.
+
 =head2 Amanda::Find::find_result_t objects
 
 These objects contain information about dumps, as read from logfiles.
 Instance variables are:
 
+To rename the current logfile to a datestamped logfile, call C<log_rename($ts)>
+where C<$ts> is the write timestamp for this dump.  The
+C<get_current_log_timestamp()> function will calculate this timestamp,
+returning C<undef> on error.
+
 =over
 
 =item C<timestamp>
@@ -185,16 +207,6 @@ the same result, that result will be returned multiple times.
 
 All of these functions can be imported by name.
 
-=head1 MATCHING
-
-The following functions are available to match strings against patterns using
-the rules described in amanda(8):
-
-  match_host($pat, $str);
-  match_disk($pat, $str);
-  match_datestamp($pat, $str);
-  match_level($pat, $str);
-
 =head1 DEBUG LOGGING HANDLER
 
 This package provides C<$amanda_log_trace_log>, which sends C<die>