php-makephar/src/global.php

27 lines
825 B
PHP

<?php
class LogFuncs {
public static function bind() {
static $bound;
if ($bound++) return;
}
}
if (@empty(STDOUT) || (!posix_isatty(STDOUT))) {
define("LF_INFO", "");
define("LF_DEBUG", "");
define("LF_WARN", "");
define("LF_RESET", "");
define("IS_TTY", false);
} else {
define("LF_INFO", "\e[32;1m");
define("LF_DEBUG", "\e[32m");
define("LF_WARN", "\e[31;1m");
define("LF_RESET", "\e[0m");
define("IS_TTY", true);
}
function log_info($fmt,...$arg) { defined("QUIET") || printf(LF_INFO."[info] {$fmt}".LF_RESET."\n", ...$arg); }
function log_debug($fmt,...$arg) { defined("QUIET") || printf(LF_DEBUG."[debg] {$fmt}".LF_RESET."\n", ...$arg); }
function log_warn($fmt,...$arg) { defined("QUIET") || printf(LF_WARN."[warn] {$fmt}".LF_RESET."\n", ...$arg); }