Stephen Quinney > BuzzSaw-0.12.0 > BuzzSaw::ReportLog

Download:
BuzzSaw-0.12.0.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  1
View/Report Bugs
Module Version: 0.12.0   Source  

NAME ^

BuzzSaw::ReportLog - Tracks when BuzzSaw reports were last run.

VERSION ^

This documentation refers to BuzzSaw::ReportLog version 0.12.0

SYNOPSIS ^

use BuzzSaw::ReportLog;

my $log = BuzzSaw::ReportLog->new();

$log->set_hourly_timestamp( 'myreport' => time );

if ( $log->get_hourly_timestamp('myreport') ) { my $tstamp = $log->get_hourly_timestamp('myreport'); }

DESCRIPTION ^

This module provides a simple interface for storing timestamps (seconds since the unix epoch) of BuzzSaw reports. The reports are split into 4 categories - hourly, daily, weekly and monthly. It is used by the BuzzSaw::Reporter module to ensure reports are not run more frequently than desired.

The BuzzSaw project provides a suite of tools for processing log file entries. Entries in files are parsed and filtered into a set of events of interest which are stored in a database. A report generation framework is also available which makes it easy to generate regular reports regarding the events discovered.

ATTRIBUTES ^

hourly

This is a reference to a hash which is used to store the timestamps of reports which are run hourly. It cannot be set as part of the call to the new method to create a new object.

daily

This is a reference to a hash which is used to store the timestamps of reports which are run daily. It cannot be set as part of the call to the new method to create a new object.

weekly

This is a reference to a hash which is used to store the timestamps of reports which are run weekly. It cannot be set as part of the call to the new method to create a new object.

monthly

This is a reference to a hash which is used to store the timestamps of reports which are run monthly. It cannot be set as part of the call to the new method to create a new object.

store_after_change

This is a boolean which is used to control whether or not changes should be immediately written back to the storage file. The default is false. When it is false the changes will still be written back if an explicit call is made to the store method or when the object is destroyed as it goes out of scope.

file

This is a string attribute which is used to specify the name of the file into which the timestamps should be stored. The default is /var/lib/buzzsaw/report.runlog.yaml.

SUBROUTINES/METHODS ^

new

Creates a new BuzzSaw::ReportLog object. If the file attribute is specified and the file exists then an attempt will be made to load the stored timestamp data using YAML::Syck.

$log->has_hourly_timestamp($report_name)

Returns true or false to indicate whether (or not) a timestamp has been recorded for an hourly report of this name.

$time = $log->get_hourly_timestamp($report_name)

Retrieves the timestamp, in seconds since the unix epoch, for an hourly report of this name.

$log->set_hourly_timestamp($report_name => time )

Sets the timestamp, in seconds since the unix epoch, for an hourly report of this name. If the store_after_change attribute is set to true then the change will immediately be written back to the log file.

$log->has_daily_timestamp($report_name)

Returns true or false to indicate whether (or not) a timestamp has been recorded for an daily report of this name.

$time = $log->get_daily_timestamp($report_name)

Retrieves the timestamp, in seconds since the unix epoch, for a daily report of this name.

$log->set_daily_timestamp($report_name => time )

Sets the timestamp, in seconds since the unix epoch, for a daily report of this name. If the store_after_change attribute is set to true then the change will immediately be written back to the log file.

$log->has_weekly_timestamp($report_name)

Returns true or false to indicate whether (or not) a timestamp has been recorded for a weekly report of this name.

$time = $log->get_weekly_timestamp($report_name)

Retrieves the timestamp, in seconds since the unix epoch, for a weekly report of this name.

$log->set_weekly_timestamp($report_name => time )

Sets the timestamp, in seconds since the unix epoch, for a weekly report of this name. If the store_after_change attribute is set to true then the change will immediately be written back to the log file.

$log->has_monthly_timestamp($report_name)

Returns true or false to indicate whether (or not) a timestamp has been recorded for a monthly report of this name.

$time = $log->get_monthly_timestamp($report_name)

Retrieves the timestamp, in seconds since the unix epoch, for a monthly report of this name.

$log->set_monthly_timestamp($report_name => time )

Sets the timestamp, in seconds since the unix epoch, for a monthly report of this name. If the store_after_change attribute is set to true then the change will immediately be written back to the log file.

$log->store([$force])

This method can be called to write the log out to the file. It will only do something if changes have been made to any of the timestamps or if the optional force parameter is set to true. If the newly generated file is identical to the previous one then no replacement is made so that file modification times are preserved.

DEPENDENCIES ^

This module is powered by Moose. It uses YAML::Syck to store the log data into a file. It also uses Text::Diff to check if the file has changed so that it only has to overwrite when absolutely necessary.

SEE ALSO ^

BuzzSaw, BuzzSaw::Reporter, BuzzSaw::Report

PLATFORMS ^

This is the list of platforms on which we have tested this software. We expect this software to work on any Unix-like platform which is supported by Perl.

ScientificLinux6

BUGS AND LIMITATIONS ^

Please report any bugs or problems (or praise!) to bugs@lcfg.org, feedback and patches are also always very welcome.

AUTHOR ^

    Stephen Quinney <squinney@inf.ed.ac.uk>

LICENSE AND COPYRIGHT ^

    Copyright (C) 2012 University of Edinburgh. All rights reserved.

This library is free software; you can redistribute it and/or modify it under the terms of the GPL, version 2 or later.

syntax highlighting: