Skip to content

Commit 41aceb4

Browse files
committed
edits
1 parent f37d0fe commit 41aceb4

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

source/monitoring-logging/logging.txt

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,17 @@ Overview
2121
--------
2222

2323
In this guide, you can learn how to use the {+library-short+} to
24-
set up and configure **logging**.
24+
set up and configure **logging**. Logging allows you to receive
25+
information about database operations, server connections, errors,
26+
and other events that occur while your application runs.
2527

2628
The {+library-short+} supports `Psr\\Log\\LoggerInterface
2729
<https://www.php-fig.org/psr/psr-3/#3-psrlogloggerinterface>`__, a PSR-3
28-
logger interface that allows your application to receive log messages.
30+
logger interface that configures your application to receive log messages.
2931
You can register one or more ``Psr\Log\LoggerInterface`` objects to
30-
send ``libmongoc`` and {+extension-short+} messages to the logger.
32+
send messages to the logger. The {+library-short+} is built on top of
33+
``libmongoc`` and {+extension-short+}, so the logger receives event notifications
34+
from both components.
3135

3236
Register a Logger
3337
-----------------
@@ -37,25 +41,25 @@ create a logger class that implements the ``Psr\Log\LoggerInterface``
3741
interface. Then, use the ``MongoDB\add_logger()`` function to register
3842
your logger.
3943

40-
To implement ``Psr\Log\LoggerInterface``, you can create a class that
41-
extends the ``Psr\Log\AbstractLogger`` class. ``AbstractLogger`` implements
42-
``LoggerInterface`` and a generic ``log()`` method, which receives each type
43-
of log message.
44-
45-
Each message includes the following information:
44+
Each log message includes the following information:
4645

4746
- Log level: Indicates the severity of the message. To view a list of
4847
possible levels, see `PSR\\Log\\LogLevel <https://www.php-fig.org/psr/psr-3/#5-psrlogloglevel>`__.
4948
- Message: Describes the logged event.
5049
- Domain string: Specifies the driver component that emitted the log message.
5150

51+
To implement ``Psr\Log\LoggerInterface``, you can create a class that
52+
extends the ``Psr\Log\AbstractLogger`` class. ``AbstractLogger`` implements
53+
``LoggerInterface`` and a generic ``log()`` method, which receives log
54+
messages at each severity level.
55+
5256
Example
5357
~~~~~~~
5458

5559
This example performs the following actions:
5660

5761
- Creates a logger called ``MyLogger`` that extends the ``AbstractLogger`` class
58-
and prints the severity level, description, and domain of each event
62+
and records the log level, description, and domain of each event
5963
- Registers the logger
6064
- Creates a client that connects to a CosmosDB cluster
6165
- Prints each log message
@@ -114,15 +118,15 @@ This example performs the following actions:
114118

115119
The preceding output includes log messages with a ``debug`` severity level, which
116120
describe normal driver activities. It also includes a message about the CosmosDB
117-
connection with an ``info`` severity level that describes a noteworthy but non-urgent
121+
connection with an ``info`` level that describes a noteworthy but non-urgent
118122
event.
119123

120124
Write Custom Log Messages
121125
-------------------------
122126

123127
You can generate custom log messages by using the ``PsrLogAdapter::writeLog()``
124128
function. This function allows you to write directly to the logger and
125-
can assist with application debugging. Pass the severity level, domain, and
129+
can help with application monitoring and debugging. Pass the severity level, domain, and
126130
description as parameters to ``writeLog()``.
127131

128132
The following example writes log messages that have ``warning`` and
@@ -132,8 +136,8 @@ The following example writes log messages that have ``warning`` and
132136
:copyable:
133137

134138
.. input:: /includes/monitoring-logging/logging.php
135-
:start-after: start-register-logger
136-
:end-before: end-register-logger
139+
:start-after: start-write-messages
140+
:end-before: end-write-messages
137141
:language: php
138142
:dedent:
139143

0 commit comments

Comments
 (0)