当前位置: 首页>>代码示例>>PHP>>正文


PHP Logger::notice方法代码示例

本文整理汇总了PHP中Zend\Log\Logger::notice方法的典型用法代码示例。如果您正苦于以下问题:PHP Logger::notice方法的具体用法?PHP Logger::notice怎么用?PHP Logger::notice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend\Log\Logger的用法示例。


在下文中一共展示了Logger::notice方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: notice

 /**
  * Log de notice
  * @param  string $pathLog caminho do erro
  * @param  string $message mensagem de erro
  * @return boolean
  */
 public static function notice($pathLog, $message)
 {
     self::createLogger();
     self::$logger->addWriter(new \Zend\Log\Writer\Stream($pathLog . DIRECTORY_SEPARATOR . "notice.log"));
     self::$logger->notice($message);
     self::destroyLogger();
     return TRUE;
 }
开发者ID:brunosccp1910,项目名称:XSADMIN,代码行数:14,代码来源:Log.php

示例2: transactionReceived

 public function transactionReceived(string $address, float $amount)
 {
     $this->logger->notice("Received transaction to address {$address}");
     $stmt = $this->connection->prepare('UPDATE addresses SET last_used = NULL WHERE address = :address');
     $stmt->execute([':address' => $address]);
     $addressMaxAge = new \DateTime($this->addressLockTime);
     $stmt = $this->connection->prepare('SELECT id, ordered_genre_id, price FROM orders WHERE address = :address AND ordered > :maxAge AND paid = FALSE');
     $stmt->execute([':address' => $address, ':maxAge' => $addressMaxAge->format("Y-m-d H:i:s")]);
     $result = $stmt->fetch(PDO::FETCH_ASSOC);
     $orderId = $result['id'];
     $orderedGenreId = $result['ordered_genre_id'];
     $price = $result['price'];
     if ($price > $amount) {
         //if paid amount is smaller than ordered price
         return;
     }
     $stmt = $this->connection->prepare('UPDATE orders SET paid = TRUE WHERE address = :address AND ordered > :maxAge AND paid = FALSE');
     $stmt->execute([':address' => $address, ':maxAge' => $addressMaxAge->format("Y-m-d H:i:s")]);
     if ($orderedGenreId != null) {
         file_put_contents($this->currentGenreFile, $orderedGenreId);
     }
     $this->logger->info("{$orderId} has been paid");
     $stmt = $this->connection->prepare('UPDATE queue SET paid = TRUE WHERE order_id = :id');
     $stmt->execute([':id' => $orderId]);
 }
开发者ID:ParalelniPolis,项目名称:bitcoinJukebox,代码行数:25,代码来源:TransactionReader.php

示例3: setSchema

 /**
  * Create or update table according to schema
  *
  * @param \Zend\Log\Logger $logger Logger instance
  * @param array $schema Parsed table schema
  * @param \Nada\Database\AbstractDatabase $database Database object
  * @param string[] $obsoleteColumns List of obsolete columns to prune or warn about
  * @param bool $prune Drop obsolete tables/columns
  */
 public static function setSchema($logger, $schema, $database, array $obsoleteColumns = array(), $prune = false)
 {
     $tableName = $schema['name'];
     if (in_array($tableName, $database->getTableNames())) {
         // Table exists
         // Update table and column comments
         $table = $database->getTable($tableName);
         if ($schema['comment'] != $table->getComment()) {
             $table->setComment($schema['comment']);
         }
         $columns = $table->getColumns();
         foreach ($schema['columns'] as $column) {
             if (isset($columns[$column['name']])) {
                 // Column exists. Set comment.
                 $columnObj = $table->getColumn($column['name']);
                 $columnObj->setComment($column['comment']);
                 // Change datatype if different.
                 if ($columnObj->getDatatype() != $column['type'] or $columnObj->getLength() != $column['length']) {
                     $logger->info("Setting column {$tableName}.{$column['name']} type to {$column['type']}({$column['length']})...");
                     $columnObj->setDatatype($column['type'], $column['length']);
                     $logger->info('done.');
                 }
                 // Change constraints if different.
                 if ($columnObj->getNotNull() != $column['notnull']) {
                     $logger->info(($column['notnull'] ? 'Setting' : 'Removing') . " NOT NULL constraint on column {$tableName}.{$column['name']}...");
                     $columnObj->setNotNull($column['notnull']);
                     $logger->info('done.');
                 }
                 // Change default if different.
                 // Since SQL types cannot be completely mapped to PHP
                 // types, a loose comparision is required, but changes
                 // to/from NULL must be taken into account.
                 if ($columnObj->getDefault() === null and $column['default'] !== null or $columnObj->getDefault() !== null and $column['default'] === null or $columnObj->getDefault() != $column['default']) {
                     $logger->info(sprintf("Setting default value of column {$tableName}.{$column['name']} to %s...", $column['default'] === null ? 'NULL' : "'{$column['default']}'"));
                     $columnObj->setDefault($column['default']);
                     $logger->info('done.');
                 }
             } else {
                 $logger->info("Creating column {$tableName}.{$column['name']}...");
                 $table->addColumnObject($database->createColumnFromArray($column));
                 $logger->info('done.');
             }
         }
         // Check for altered PK definition
         $primaryKey = $table->getPrimaryKey();
         if ($primaryKey) {
             foreach ($primaryKey as &$column) {
                 $column = $column->getName();
             }
             unset($column);
         } else {
             $primaryKey = array();
         }
         if ($schema['primary_key'] != $primaryKey) {
             $logger->info(sprintf('Changing PK of %s from (%s) to (%s)...', $tableName, implode(', ', $primaryKey), implode(', ', $schema['primary_key'])));
             $table->setPrimaryKey($schema['primary_key']);
             $logger->info('done.');
         }
     } else {
         // Table does not exist, create it
         $logger->info("Creating table '{$tableName}'...");
         $table = $database->createTable($tableName, $schema['columns'], $schema['primary_key']);
         $table->setComment($schema['comment']);
         if ($database->isMySql()) {
             $table->setEngine($schema['mysql']['engine']);
             $table->setCharset('utf8');
         }
         $logger->info('done.');
     }
     // Create missing indexes. Ignore name for comparision with existing indexes.
     if (isset($schema['indexes'])) {
         foreach ($schema['indexes'] as $index) {
             if (!$table->hasIndex($index['columns'], $index['unique'])) {
                 $logger->info("Creating index '{$index['name']}'...");
                 $table->createIndex($index['name'], $index['columns'], $index['unique']);
                 $logger->info('done.');
             }
         }
     }
     // Detect obsolete columns that are present in the database but not in
     // the current schema.
     foreach ($obsoleteColumns as $column) {
         if ($prune) {
             $logger->notice("Dropping column {$tableName}.{$column}...");
             $table->dropColumn($column);
             $logger->notice('done.');
         } else {
             $logger->warn("Obsolete column {$tableName}.{$column} detected.");
         }
     }
 }
开发者ID:hschletz,项目名称:braintacle,代码行数:100,代码来源:SchemaManager.php

示例4: _dropColumnIfExists

 /**
  * Drop a column if it exists
  *
  * @param \Zend\Log\Logger $logger Logger instance
  * @param \Nada\Database\AbstractDatabase $database Database object
  * @param string $column column name
  * @codeCoverageIgnore
  */
 protected function _dropColumnIfExists($logger, $database, $column)
 {
     $tables = $database->getTables();
     if (isset($tables[$this->table])) {
         $table = $tables[$this->table];
         $columns = $table->getColumns();
         if (isset($columns[$column])) {
             $logger->notice("Dropping column {$this->table}.{$column}...");
             $table->dropColumn($column);
             $logger->notice('done.');
         }
     }
 }
开发者ID:hschletz,项目名称:braintacle,代码行数:21,代码来源:AbstractTable.php


注:本文中的Zend\Log\Logger::notice方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。