Skip to content

Commit

Permalink
Improve logging of commands. Related to issue #40.
Browse files Browse the repository at this point in the history
  • Loading branch information
gmazoyer committed Jun 27, 2018
1 parent 9718858 commit 5bc4183
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion routers/router.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,19 @@ public function send_command($command, $parameter) {
$data = '';

foreach ($commands as $selected) {
$log = str_replace(array('%D', '%R', '%H', '%C'),
array(date('Y-m-d H:i:s'), $this->requester, $this->config['host'],
'[BEGIN] '.$selected), $this->global_config['logs']['format']);
log_to_file($log);

$output = $auth->send_command($selected);
$output = $this->sanitize_output($output);

$data .= $this->format_output($selected, $output);

$log = str_replace(array('%D', '%R', '%H', '%C'),
array(date('Y-m-d H:i:s'), $this->requester, $this->config['host'],
$selected), $this->global_config['logs']['format']);
'[END] '.$selected), $this->global_config['logs']['format']);
log_to_file($log);
}
} catch (Exception $e) {
Expand Down

0 comments on commit 5bc4183

Please sign in to comment.