1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
<?php
// In the future, this will log to the database and require a build ID, but for now it just prints
function log_msg($msg, $nl=true) { // This is a quick hack, we need to do something smarter
debug($msg.($nl?"\n":''));
}
function log_status($msg, $result) {
log_msg($msg."... ".($result?color('[success]', 'green'):color('[failure]', 'red')));
return $result;
}
function color($msg, $color) {
$i=30;
$colors=array(
'black' => $i++,
'red' => $i++,
'green' => $i++,
'yellow' => $i++,
'blue' => $i++,
'magenta' => $i++,
'cyan' => $i++,
'white' => $i++
);
return "\033[".$colors[$color]."m$msg\033[0m";
}
?>
|