Created
July 6, 2012 00:51
-
-
Save kevcao/3057360 to your computer and use it in GitHub Desktop.
phplog
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/php | |
<?php | |
print_r($argv); | |
if (count($argv) < 3) { | |
die("wrong number of arguments\n"); | |
} | |
$priority = $argv[1]; | |
$data = $argv[2]; | |
if ($priority == "emerg") { | |
$log_priority = '0'; | |
} elseif ($priority == "alert") { | |
$log_priority = '1'; | |
} elseif ($priority == "crit") { | |
$log_priority = '2'; | |
} elseif ($priority == "err") { | |
$log_priority = '3'; | |
} elseif ($priority == "warning") { | |
$log_priority = '4'; | |
} elseif ($priority == "notice") { | |
$log_priority = '5'; | |
} elseif ($priority == "info") { | |
$log_priority = '6'; | |
} elseif ($priority == "debug") { | |
$log_priority = '7'; | |
} else { | |
die("unknow priority\n"); | |
} | |
print $log_priority; | |
syslog((int)$log_priority,$data); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment