Skip to content
Snippets Groups Projects

dev#176789 : task#179397 : log to temp file

Merged Henri-Damien LAURENT requested to merge dev#176789_gers into master
All threads resolved!
Compare and
1 file
+ 17
8
Preferences
Compare changes
<?php
require(__DIR__.'/../console.php');
require_once(__DIR__.'/../cosmogramme/php/_init.php');
require_once(__DIR__.'/../cosmogramme/php/classes/classe_log.php');
$filename = $argv[1];
$subfield = $argv[2];
@@ -16,11 +13,23 @@ It stores records with related items depending on the subfield parameter.
Usage : php split_unimarc_by_site.php <file_to_split_path> <subfield_tag_to_split_file_on> <destination_directory>
EOF;
$log = new log('integration');
$log_debug = new log('debug', false);
$log->setDebugLog($log_debug);
$log->open(true);
$log_debug->open(true);
class Write_Log_In_Temp {
protected $_path = './temp/split_unimarc_by_site.log';
public function __construct() {
file_put_contents($this->_path,
'');
}
public function log($message) {
file_put_contents($this->_path,
$message . "\n",
FILE_APPEND);
}
}
$log = new Write_Log_In_Temp;
(new Class_Cosmogramme_Integration_SplitBySite)
->setLogger($log)