File tree Expand file tree Collapse file tree 3 files changed +54
-9
lines changed Expand file tree Collapse file tree 3 files changed +54
-9
lines changed Original file line number Diff line number Diff line change
1
+ # Changelog
2
+
3
+ ## 0.1 (2020-03-26)
4
+
5
+ - Added ` StdlibFormatter ` for use with the standard library ` logging ` module
6
+ - Added ` StructlogFormatter ` for use with the ` structlog ` package
Original file line number Diff line number Diff line change @@ -84,22 +84,54 @@ structlog.configure(
84
84
logger = structlog.get_logger(" app" )
85
85
86
86
# Add additional context
87
- logger = logger.bind(** {" log.logger" : " app" })
87
+ logger = logger.bind(** {
88
+ " http" : {
89
+ " version" : " 2" ,
90
+ " request" : {
91
+ " method" : " get" ,
92
+ " bytes" : 1337 ,
93
+ },
94
+ },
95
+ " url" : {
96
+ " domain" : " example.com" ,
97
+ " path" : " /" ,
98
+ " port" : 443 ,
99
+ " scheme" : " https" ,
100
+ " registered_domain" : " example.com" ,
101
+ " top_level_domain" : " com" ,
102
+ " original" : " https://example.com" ,
103
+ }
104
+ })
88
105
89
106
# Emit a log!
90
107
logger.debug(" Example message!" )
91
108
```
92
109
``` json
93
110
{
94
- "@timestamp" : " 2020-03-20T18:10:32.972Z" ,
95
- "ecs" : {
96
- "version" : " 1.5.0"
111
+ "@timestamp" : " 2020-03-26T13:08:11.728Z" ,
112
+ "ecs" : {
113
+ "version" : " 1.5.0"
114
+ },
115
+ "http" : {
116
+ "request" : {
117
+ "bytes" : 1337 ,
118
+ "method" : " get"
97
119
},
98
- "log" : {
99
- "level" : " debug" ,
100
- "logger" : " app"
101
- },
102
- "message" : " Example message!"
120
+ "version" : " 2"
121
+ },
122
+ "log" : {
123
+ "level" : " debug"
124
+ },
125
+ "message" : " Example message!" ,
126
+ "url" : {
127
+ "domain" : " example.com" ,
128
+ "original" : " https://example.com" ,
129
+ "path" : " /" ,
130
+ "port" : 443 ,
131
+ "registered_domain" : " example.com" ,
132
+ "scheme" : " https" ,
133
+ "top_level_domain" : " com"
134
+ }
103
135
}
104
136
```
105
137
Original file line number Diff line number Diff line change @@ -30,3 +30,10 @@ develop = [
30
30
" mock" ,
31
31
" structlog" ,
32
32
]
33
+
34
+ [tool .flit .metadata .urls ]
35
+ "Source" = " https://github.com/elastic/ecs-logging-python"
36
+ "Download" = " https://github.com/elastic/ecs-logging-python/releases"
37
+ "Documentation" = " https://github.com/elastic/ecs-logging-python"
38
+ "Issue Tracker" = " https://github.com/elastic/ecs-logging-python/issues"
39
+ "Changelog" = " https://github.com/elastic/ecs-logging-python/blob/master/CHANGELOG.md"
You can’t perform that action at this time.
0 commit comments