本文整理汇总了PHP中Console::log方法的典型用法代码示例。如果您正苦于以下问题:PHP Console::log方法的具体用法?PHP Console::log怎么用?PHP Console::log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Console
的用法示例。
在下文中一共展示了Console::log方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wpdt_init
function wpdt_init()
{
if (!is_admin() && current_user_can("level_10") && get_option('wpdt_quick_profiler')) {
$this->db = new MySqlDatabase(DB_HOST, DB_USER, DB_PASSWORD);
$this->db->connect(true);
$this->db->changeDatabase(DB_NAME);
$this->profiler = new PhpQuickProfiler(PhpQuickProfiler::getMicroTime());
Console::logSpeed('Initializing...');
if (get_option('wpdt_log_predefined_php') == 'checked') {
//PHP Predefined Variables
Console::log($_COOKIE, '_COOKIE');
Console::log($_ENV, '_ENV');
Console::log($_FILES, '_FILES');
Console::log($_GET, '_GET');
Console::log($PHP_SELF, '_PHP_SELF');
Console::log($_POST, '_POST');
Console::log($_REQUEST, '_REQUEST');
Console::log($_SERVER, '_SERVER');
Console::log($_SESSION, '_SESSION');
}
foreach ($this->filter_list as $filter) {
if (get_option('wpdt_' . $filter) == 'checked') {
add_filter($filter, 'wpdt_' . $filter);
} else {
remove_filter($filter, 'wpdt_' . $filter);
}
}
} else {
remove_action('init', array(&$this, 'wpdt_init'));
remove_action('wp_footer', array(&$this, 'wpdt_end'));
}
}
示例2: alert
public static function alert($mensagem, $log = false)
{
if (PROFILER) {
if (class_exists("Console")) {
Console::log($mensagem);
}
} else {
$cod = time() . rand();
echo "<div id=\"alert" . $cod . "\" style=\"";
echo "border:2px solid #456abc; background-color:#ffffe7; color:#000000; ";
echo "margin:auto; width:75%; margin-top:10px; text-align:center; ";
echo "padding:10px; padding-top:0px; font-family: 'Times New Roman', ";
echo "serif; font-style:italic;\">\n";
echo "<div style=\"float:right; width:100%; text-align:right; ";
echo "clear:both;\">\n";
echo "<a href=\"#alert" . $cod . "\" onclick=\"";
echo "document.getElementById('alert" . $cod . "').style.display='none';\" ";
echo "style=\"color: #aa0000; font-size: 1em; text-decoration: none;\" ";
echo "title=\"Fechar\">x</a></div>";
echo "\n" . utf8_decode($mensagem) . "\n";
echo "</div>\n";
}
if (NLOGS == 2 || NLOGS == 3 || $log) {
gravalog('001', $mensagem);
// Grava em log o Alerta
}
}
示例3: logger
function logger($level, $msg, $method = null)
{
static $labels = array(100 => 'DEBUG', 200 => 'INFO', 250 => 'NOTICE', 300 => 'WARNING', 400 => 'ERROR', 500 => 'CRITICAL', 550 => 'ALERT', 600 => 'EMERGENCY', 700 => 'ALL');
// make sure $level has the correct value
if (is_int($level) and !isset($labels[$level]) or is_string($level) and !array_search(strtoupper($level), $labels)) {
throw new \FuelException('Invalid level "' . $level . '" passed to logger()');
}
if (is_string($level)) {
$level = array_search(strtoupper($level), $labels);
}
// get the levels defined to be logged
$loglabels = \Config::get('log_threshold');
// bail out if we don't need logging at all
if ($loglabels == \Fuel::L_NONE) {
return false;
}
// if profiling is active log the message to the profile
if (\Config::get('profiling')) {
\Console::log($method . ' - ' . $msg);
}
// if it's not an array, assume it's an "up to" level
if (!is_array($loglabels)) {
$a = array();
foreach ($labels as $l => $label) {
$l >= $loglabels and $a[] = $l;
}
$loglabels = $a;
}
// do we need to log the message with this level?
if (!in_array($level, $loglabels)) {
return false;
}
return \Log::instance()->log($level, (empty($method) ? '' : $method . ' - ') . $msg);
}
示例4: index
/**
* Index Page for this controller.
*
* Maps to the following URL
* http://example.com/index.php/welcome
* - or -
* http://example.com/index.php/welcome/index
* - or -
* Since this controller is set as the default controller in
* config/routes.php, it's displayed at http://example.com/
*
* So any other public methods not prefixed with an underscore will
* map to /index.php/welcome/<method_name>
* @see http://codeigniter.com/user_guide/general/urls.html
*/
public function index()
{
$arg = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 0);
Console::log($arg);
$this->output->enable_profiler(true);
$this->load->view('welcome_message');
}
示例5: index
public function index()
{
$this->load->spark('Debug-Toolbar/1.x.x');
$this->load->library('console');
$this->output->enable_profiler(true);
Console::log('Hey, this is really cool');
$this->load->view('index');
}
示例6: logger
function logger($level, $msg, $method = null)
{
if (Config::get('profiling')) {
\Console::log($method . ' - ' . $msg);
}
if ($level > \Config::get('log_threshold')) {
return false;
}
\Log::write($level, $msg, $method);
}
示例7: logger
function logger($level, $msg, $method = null)
{
!class_exists('Fuel\\Core\\Log') and import('log');
!class_exists('Log') and class_alias('Fuel\\Core\\Log', 'Log');
if (Config::get('profiling')) {
\Console::log($method . ' - ' . $msg);
}
if ($level > \Config::get('log_threshold')) {
return false;
}
\Log::write($level, $msg, $method);
}
示例8: getTopSellersByNode
/**
* BrowseNodeをTopSellersを取得して結果を配列で返す
*
* @param (array|string) $conditions 検索条件
* @return array 検索結果
*/
public function getTopSellersByNode($conditions)
{
$_ = $this;
$AmazonSearch = new AmazonSearchLib();
$params = array_merge($_->params, $conditions);
$result = $AmazonSearch->getTopSellersByNode($params, $_->secretKey);
if ($_->dispatch_trace) {
Console::log('AmazonschModel::get');
Console::log($result);
}
return $result;
}
示例9: mark
public function mark($file, $line, $msg = '##MARK##')
{
if ($this->status != self::PROFILER_STATUS_STARTED) {
$this->restart();
}
$now = $this->_getCurrentTime();
$elapsed = $now - $this->startTime;
$elapsed = sprintf('%f seconds', $elapsed);
$timestamp = sprintf('[@%f]', $now);
$mark = "{$timestamp} {$msg} <br />in {$file} at line {$line} after {$elapsed}";
$this->log[] = $mark;
Console::log($mark, 'profile');
}
示例10: trigger
/**
* @uses SimpleLog_Receiver
* @param string $event
* @param int|string|null $objectId
* @param int|null $userId
* @param string|array|object|null $additionalData
*/
function trigger($event, $objectId = null, $userId = null, $additionalData = null, $alert = false)
{
global $config;
if (class_exists('Console')) {
Console::log($event, 'SimpleLog::trigger');
}
$instance = SimpleLog_Receiver::getInstance();
$instance->trigger($event, $objectId, $userId, $additionalData);
if ($alert) {
mail($config['systemEmail'], $event, print_r(array('Object ID' => $objectId, 'User ID' => $userId, 'Additional Data' => $additionalData), 1), 'From: ' . $config['systemEmail']);
}
}
示例11: createTable
protected final function createTable($tableName, $options, $tableInfo = '')
{
\Console::log("Creating table {0}...\n", [$tableName], [\Console::FG_YELLOW]);
if (is_array($options)) {
$a = [];
foreach ($options as $key => $value) {
$a[] = is_string($key) ? "`{$key}` {$value}" : $value;
}
$options = implode(',', $a);
}
$query = "CREATE TABLE `{$tableName}` ({$options}) {$tableInfo}";
\Console::log("{$query}\n\n");
CW::$app->db->executeUpdate($query);
}
示例12: write
/**
* Write Log File
*
* Generally this function will be called using the global log_message() function
*
* @access public
* @param string the error level
* @param string the error message
* @return bool
*/
public static function write($level, $msg, $method = null)
{
if ($level > \Config::get('log_threshold')) {
return false;
}
switch ($level) {
case \Fuel::L_ERROR:
$level = 'Error';
break;
case \Fuel::L_DEBUG:
$level = 'Debug';
break;
case \Fuel::L_INFO:
$level = 'Info';
break;
}
if (Config::get('profiling')) {
\Console::log($method . ' - ' . $msg);
}
$filepath = \Config::get('log_path') . date('Y/m') . '/';
if (!is_dir($filepath)) {
$old = umask(0);
mkdir($filepath, 0777, true);
chmod($filepath, 0777);
umask($old);
}
$filename = $filepath . date('d') . '.php';
$message = '';
if (!file_exists($filename)) {
$message .= "<" . "?php defined('COREPATH') or exit('No direct script access allowed'); ?" . ">" . PHP_EOL . PHP_EOL;
}
if (!($fp = @fopen($filename, 'a'))) {
return false;
}
$call = '';
if (!empty($method)) {
$call .= $method;
}
$message .= $level . ' ' . ($level == 'info' ? ' -' : '-') . ' ';
$message .= date(\Config::get('log_date_format'));
$message .= ' --> ' . (empty($call) ? '' : $call . ' - ') . $msg . PHP_EOL;
flock($fp, LOCK_EX);
fwrite($fp, $message);
flock($fp, LOCK_UN);
fclose($fp);
$old = umask(0);
@chmod($filename, 0666);
umask($old);
return true;
}
示例13: __construct
function __construct()
{
global $db;
$configs = $db->query('SELECT * FROM {{table}}', 'plugins');
while ($plugin = mysql_fetch_array($configs)) {
$this->config_plugins[$plugin['name_plugins']] = array('id' => $plugin['id_plugins'], 'acti' => $plugin['activate_plugins'], 'menu' => $plugin['menu_plugins'], 'page' => $plugin["page_plugins"], 'pos' => $plugin["pos_plugins"]);
}
Console::log($this->config_plugins);
foreach ($GLOBALS as $a => $b) {
if (preg_match("/_root/i", $a)) {
$this->root = $b;
break;
}
}
}
示例14: sampleConsoleData
public function sampleConsoleData() {
try {
Console::log('Begin logging data');
Console::logMemory($this, 'PQP Example Class : Line '.__LINE__);
Console::logSpeed('Time taken to get to line '.__LINE__);
Console::log(array('Name' => 'Ryan', 'Last' => 'Campbell'));
Console::logSpeed('Time taken to get to line '.__LINE__);
Console::logMemory($this, 'PQP Example Class : Line '.__LINE__);
Console::log('Ending log below with a sample error.');
throw new Exception('Unable to write to log!');
}
catch(Exception $e) {
Console::logError($e, 'Sample error logging.');
}
}
示例15: search
/**
* Search for companies
*
* @param string $keyword Query string
* @param int $limit Max number of results
* @return array
*
* @url GET search
* @url GET search/{keyword}
* @url GET search/{keyword}/{limit}
* @access protected
*/
function search($keyword = NULL, $limit = NULL)
{
if ($limit && !is_int($limit)) {
return;
}
if (!$limit) {
$limit = 10;
}
$return = array();
Console::log("test");
$query = "SELECT company_ID, company_name, company_url, company_phone" . " FROM companies C" . " WHERE" . " (company_name LIKE '%{{keyword}}%' OR company_details LIKE '%{{keyword}}%' OR company_url LIKE '%{{keyword}}%')" . " LIMIT 0,{{limit}}";
$companies = $this->db->query($query, array('keyword' => $keyword, 'limit' => $limit));
while ($companies && ($company = $this->db->fetch_assoc($companies))) {
$return[] = $company;
}
return $return;
}