Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
Zend_Log_Writer_Stream Class Reference
Inheritance diagram for Zend_Log_Writer_Stream:
Zend_Log_Writer_Abstract Zend_Log_FactoryInterface

Public Member Functions

 __construct ($streamOrUrl, $mode=null)
 
 shutdown ()
 
- Public Member Functions inherited from Zend_Log_Writer_Abstract
 addFilter ($filter)
 
 setFormatter (Zend_Log_Formatter_Interface $formatter)
 
 shutdown ()
 

Static Public Member Functions

static factory ($config)
 

Protected Member Functions

 _write ($event)
 
- Protected Member Functions inherited from Zend_Log_Writer_Abstract
 _write ($event)
 

Protected Attributes

 $_stream = null
 
- Protected Attributes inherited from Zend_Log_Writer_Abstract
 $_filters = array()
 
 $_formatter
 

Additional Inherited Members

- Static Protected Member Functions inherited from Zend_Log_Writer_Abstract
static _parseConfig ($config)
 

Detailed Description

Definition at line 37 of file Stream.php.

Constructor & Destructor Documentation

◆ __construct()

__construct (   $streamOrUrl,
  $mode = null 
)

Class Constructor

Parameters
array | string | resource$streamOrUrlStream or URL to open as a stream
string | null$modeMode, only applicable if a URL is given
Returns
void
Exceptions
Zend_Log_Exception

Definition at line 54 of file Stream.php.

55  {
56  // Setting the default
57  if (null === $mode) {
58  $mode = 'a';
59  }
60 
61  if (is_resource($streamOrUrl)) {
62  if (get_resource_type($streamOrUrl) != 'stream') {
63  #require_once 'Zend/Log/Exception.php';
64  throw new Zend_Log_Exception('Resource is not a stream');
65  }
66 
67  if ($mode != 'a') {
68  #require_once 'Zend/Log/Exception.php';
69  throw new Zend_Log_Exception('Mode cannot be changed on existing streams');
70  }
71 
72  $this->_stream = $streamOrUrl;
73  } else {
74  if (is_array($streamOrUrl) && isset($streamOrUrl['stream'])) {
75  $streamOrUrl = $streamOrUrl['stream'];
76  }
77 
78  if (! $this->_stream = @fopen($streamOrUrl, $mode, false)) {
79  #require_once 'Zend/Log/Exception.php';
80  $msg = "\"$streamOrUrl\" cannot be opened with mode \"$mode\"";
81  throw new Zend_Log_Exception($msg);
82  }
83  }
84 
85  $this->_formatter = new Zend_Log_Formatter_Simple();
86  }
if($exist=($block->getProductCollection() && $block->getProductCollection() ->getSize())) $mode
Definition: grid.phtml:15

Member Function Documentation

◆ _write()

_write (   $event)
protected

Write a message to the log.

Parameters
array$eventevent data
Returns
void
Exceptions
Zend_Log_Exception

Definition at line 129 of file Stream.php.

130  {
131  $line = $this->_formatter->format($event);
132 
133  if (false === @fwrite($this->_stream, $line)) {
134  #require_once 'Zend/Log/Exception.php';
135  throw new Zend_Log_Exception("Unable to write to stream");
136  }
137  }

◆ factory()

static factory (   $config)
static

Create a new instance of Zend_Log_Writer_Stream

Parameters
array | Zend_Config$config
Returns
Zend_Log_Writer_Stream

Implements Zend_Log_FactoryInterface.

Definition at line 94 of file Stream.php.

95  {
97  $config = array_merge(array(
98  'stream' => null,
99  'mode' => null,
100  ), $config);
101 
102  $streamOrUrl = isset($config['url']) ? $config['url'] : $config['stream'];
103 
104  return new self(
105  $streamOrUrl,
106  $config['mode']
107  );
108  }
$config
Definition: fraud_order.php:17
static _parseConfig($config)
Definition: Abstract.php:126

◆ shutdown()

shutdown ( )

Close the stream resource.

Returns
void

Definition at line 115 of file Stream.php.

116  {
117  if (is_resource($this->_stream)) {
118  fclose($this->_stream);
119  }
120  }

Field Documentation

◆ $_stream

$_stream = null
protected

Definition at line 44 of file Stream.php.


The documentation for this class was generated from the following file: