<commit_before>.. _zend.log.overview:

Overview to Zend\\Log
=====================

``Zend\Log\Logger`` is a component for general purpose logging. It supports multiple log backends, formatting
messages sent to the log, and filtering messages from being logged. These functions are divided into the following
objects:

- A Logger (instance of ``Zend\Log\Logger``) is the object that your application uses the most. You can have as
  many Logger objects as you like; they do not interact. A Logger object must contain at least one Writer, and can
  optionally contain one or more Filters.

- A Writer (inherits from ``Zend\Log\Writer\AbstractWriter``) is responsible for saving data to storage.

- A Filter (implements ``Zend\Log\Filter``) blocks log data from being saved. A filter is applied to an  individual
  writer. Filters can be chained.

- A Formatter (inheriting from ``Zend\Log\Formatter\AbstractFormatter``) can format the log data before it is
  written by a Writer. Each Writer has exactly one Formatter.

.. _zend.log.overview.creating-a-logger:

Creating a Log
--------------

To get started logging, instantiate a Writer and then pass it to a Logger instance:

.. code-block:: php
   :linenos:

   $logger = new Zend\Log\Logger;
   $writer = new Zend\Log\Writer\Stream('php://output');<commit_msg>to to of<commit_after>.. _zend.log.overview:

Overview of Zend\\Log
=====================

``Zend\Log\Logger`` is a component for general purpose logging. It supports multiple log backends, formatting
messages sent to the log, and filtering messages from being logged. These functions are divided into the following
objects:

- A Logger (instance of ``Zend\Log\Logger``) is the object that your application uses the most. You can have as
  many Logger objects as you like; they do not interact. A Logger object must contain at least one Writer, and can
  optionally contain one or more Filters.

- A Writer (inherits from ``Zend\Log\Writer\AbstractWriter``) is responsible for saving data to storage.

- A Filter (implements ``Zend\Log\Filter``) blocks log data from being saved. A filter is applied to an  individual
  writer. Filters can be chained.

- A Formatter (inheriting from ``Zend\Log\Formatter\AbstractFormatter``) can format the log data before it is
  written by a Writer. Each Writer has exactly one Formatter.

.. _zend.log.overview.creating-a-logger:

Creating a Log
--------------

To get started logging, instantiate a Writer and then pass it to a Logger instance:

.. code-block:: php
   :linenos:

   $logger = new Zend\Log\Logger;
   $writer = new Zend\Log\Writer\Stream('php://output');
{'fraction_non_alphanumeric': 0.106829454406715, 'fraction_numerical': 0.0, 'mean_word_length': 3.8287292817679557, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3306006', 'n_tokens_mistral': 733, 'n_tokens_neox': 702, 'n_words': 337}