You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 14, 2019. It is now read-only.
Copy file name to clipboardexpand all lines: README.md
+91-30
Original file line number
Diff line number
Diff line change
@@ -6,64 +6,125 @@ Symfony2 bundle with extra processors and logger to log request/response.
6
6
7
7
## Installation
8
8
9
-
```
9
+
```bash
10
10
composer require hexanet/monolog-extra-bundle
11
11
```
12
12
13
-
## Configuration reference
13
+
## Usage
14
+
15
+
### Processors
16
+
17
+
The bundle provides several processors:
18
+
19
+
* User
20
+
* Session ID
21
+
* UID
22
+
* Additions
23
+
24
+
#### User
14
25
26
+
The *UserProcessor* add data about the current user in each log entry.
27
+
28
+
```yaml
29
+
hexanet_monolog_extra:
30
+
processor:
31
+
user: true
15
32
```
33
+
34
+
The default provider returns:
35
+
* anonymous when no user is logged
36
+
* the username of the current logged user
37
+
* cli
38
+
39
+
You can create your own provider by creating a service that implements *Hexanet\Common\MonologExtraBundle\Provider\User\UserProviderInterface*.
40
+
41
+
```yaml
16
42
hexanet_monolog_extra:
43
+
provider:
44
+
user: your_own_provider_service_id
45
+
```
46
+
47
+
#### Session ID
17
48
18
-
# add data to extra in each records of log
49
+
Add the session id in each log entry.
50
+
51
+
```yaml
52
+
hexanet_monolog_extra:
19
53
processor:
54
+
session_id: true
55
+
```
20
56
21
-
# add the username of the current user
22
-
user: true
57
+
You can create your own provider by creating a service that implements *Hexanet\Common\MonologExtraBundle\Provider\Session\SessionIdProviderInterface*.
23
58
24
-
# add the session id
25
-
session_id: false
59
+
```yaml
60
+
hexanet_monolog_extra:
61
+
provider:
62
+
session_id: your_own_provider_service_id
63
+
```
26
64
27
-
# add Unique Identification Number
28
-
uid: true
65
+
#### UID
29
66
30
-
# add symfony environnement
31
-
environment: true
67
+
Add an unique identifier for the request in each log entry.
32
68
33
-
# add static data
34
-
additions:
35
-
type: symfony
36
-
application: symfony application
37
-
extra_info: blabla
69
+
```yaml
70
+
hexanet_monolog_extra:
71
+
processor:
72
+
uid: true
73
+
```
38
74
39
-
logger:
40
-
# log each request
41
-
on_request: true
75
+
The bundle comes with 2 providers:
42
76
43
-
# log console exception
44
-
on_console_exception: true
77
+
* UniqidProvider (default): use `uniqid`
78
+
* ApacheUniqueIdProvider: get from environment, need [*mod_unique_id*](https://httpd.apache.org/docs/2.4/mod/mod_unique_id.html) of Apache
45
79
46
-
# add uid in the headers of responses
47
-
add_uid_to_response: true
80
+
You can create your own provider by creating a service that implements *Hexanet\Common\MonologExtraBundle\Provider\Uid\UidProviderInterface*.
48
81
49
-
# you can change the provider for uid, user and session_id
0 commit comments