1
0
mirror of https://github.com/Yubico/yubikey-val.git synced 2025-01-20 10:52:15 +01:00
yubikey-val/ykval-log.php

34 lines
569 B
PHP
Raw Normal View History

2010-01-11 12:07:28 +00:00
<?php
class Log
{
function __construct($name='ykval')
{
$this->name=$name;
$this->fields=array();
2010-01-11 12:07:28 +00:00
}
function addField($name, $value)
{
$this->fields[$name]=$value;
}
2010-01-11 12:07:28 +00:00
function log($priority, $message, $arr=null){
if (is_array($arr)) {
foreach($arr as $key=>$value){
$message.=" $key=$value ";
}
}
# Add fields
$msg_fields = "";
foreach ($this->fields as $field=>$value) {
$mes_fields .= "[" . $value . "] ";
}
syslog($priority, $this->name . ':' . $msg_fields . $message);
2010-01-11 12:07:28 +00:00
}
}
?>