Bug 13889: Provide parameter $infos in cronlogaction()

(Alternative for patch Bug 13889: Log with parameters)

To test:

- Apply patches interactive and skip following patch:  Bug 13889: Log with parameters
- Tweak a cron job in order to call cronlogaction twice, one with a param at the beginning of the cron ob, e.g.
cronlogaction("This is my message") and one without param.
- Run this cron job.
Result: You should have two entries in the log, one with and one without additional information after the path and name of the calling script.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This commit is contained in:
Marc Véron 2015-04-21 17:19:06 +02:00 committed by Tomas Cohen Arazi
parent 00faa967bd
commit a9a8abb32f
1 changed files with 5 additions and 2 deletions

View File

@ -83,15 +83,18 @@ sub logaction {
=item cronlogaction
&cronlogaction();
&cronlogaction($infos);
Convenience routine to add a record into action_logs table from a cron job.
Logs the path and name of the calling script plus the information privided by param $infos.
=cut
#'
sub cronlogaction {
logaction( 'CRONJOBS', 'Run', 0, (caller(0))[1] ) if C4::Context->preference('CronjobLog');
my ($infos)=@_;
my $loginfo = (caller(0))[1] . ' ' . $infos;
logaction( 'CRONJOBS', 'Run', 0, $loginfo ) if C4::Context->preference('CronjobLog');
}