Skip to content

Commit 7164058

Browse files
authored
Release v0.1
1 parent 63c4d88 commit 7164058

File tree

3 files changed

+54
-9
lines changed

3 files changed

+54
-9
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
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

README.md

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,22 +84,54 @@ structlog.configure(
8484
logger = structlog.get_logger("app")
8585

8686
# 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+
})
88105

89106
# Emit a log!
90107
logger.debug("Example message!")
91108
```
92109
```json
93110
{
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"
97119
},
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+
}
103135
}
104136
```
105137

pyproject.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,10 @@ develop = [
3030
"mock",
3131
"structlog",
3232
]
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"

0 commit comments

Comments
 (0)