structlog-config 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- structlog_config-0.1.0/.copier-answers.yml +2 -0
- structlog_config-0.1.0/.envrc +11 -0
- structlog_config-0.1.0/.github/dependabot.yml +12 -0
- structlog_config-0.1.0/.github/workflows/build_and_publish.yml +56 -0
- structlog_config-0.1.0/.github/workflows/repo-sync.yml +16 -0
- structlog_config-0.1.0/.gitignore +129 -0
- structlog_config-0.1.0/.tool-versions +3 -0
- structlog_config-0.1.0/.vscode/settings.json +36 -0
- structlog_config-0.1.0/CHANGELOG.md +30 -0
- structlog_config-0.1.0/Makefile +11 -0
- structlog_config-0.1.0/PKG-INFO +62 -0
- structlog_config-0.1.0/README.md +49 -0
- structlog_config-0.1.0/copier.yml +68 -0
- structlog_config-0.1.0/pyproject.toml +56 -0
- structlog_config-0.1.0/structlog_config/__init__.py +184 -0
- structlog_config-0.1.0/structlog_config/constants.py +9 -0
- structlog_config-0.1.0/structlog_config/env_config.py +48 -0
- structlog_config-0.1.0/structlog_config/environments.py +31 -0
- structlog_config-0.1.0/structlog_config/fastapi_access_logger.py +115 -0
- structlog_config-0.1.0/structlog_config/formatters.py +166 -0
- structlog_config-0.1.0/structlog_config/packages.py +33 -0
- structlog_config-0.1.0/structlog_config/stdlib_logging.py +172 -0
- structlog_config-0.1.0/structlog_config/warnings.py +51 -0
- structlog_config-0.1.0/tests/__init__.py +0 -0
- structlog_config-0.1.0/tests/capture_utils.py +53 -0
- structlog_config-0.1.0/tests/conftest.py +114 -0
- structlog_config-0.1.0/tests/test_environment.py +118 -0
- structlog_config-0.1.0/tests/test_fastapi_access_logger.py +189 -0
- structlog_config-0.1.0/tests/test_import.py +8 -0
- structlog_config-0.1.0/tests/test_logging.py +167 -0
- structlog_config-0.1.0/tests/utils.py +35 -0
- structlog_config-0.1.0/uv.lock +1680 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
# this exact file name is required in this exact location if updates are to work
|
|
2
|
+
{"_commit": "v0.2.1-31-gb45b358", "_src_path": "https://github.com/iloveitaly/python-package-template", "project_name": "structlog_config", "full_name": "Michael Bianco", "email": "mike@mikebian.co", "github_username": "iloveitaly"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
name: Build and Publish to PyPI
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
branches:
|
|
5
|
+
- main
|
|
6
|
+
- master
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: write
|
|
10
|
+
|
|
11
|
+
env:
|
|
12
|
+
PIP_DEFAULT_TIMEOUT: 60
|
|
13
|
+
PIP_RETRIES: 5
|
|
14
|
+
|
|
15
|
+
# required otherwise github api calls are rate limited
|
|
16
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
matrix-test:
|
|
20
|
+
strategy:
|
|
21
|
+
matrix:
|
|
22
|
+
os: [ubuntu-latest, macos-latest]
|
|
23
|
+
python-version: ["3.13", "3.12", "3.11"]
|
|
24
|
+
runs-on: ${{ matrix.os }}
|
|
25
|
+
steps:
|
|
26
|
+
- uses: actions/checkout@v4
|
|
27
|
+
- uses: jdx/mise-action@v2
|
|
28
|
+
- run: mise use python@${{ matrix.python-version }}
|
|
29
|
+
- uses: iloveitaly/github-action-direnv-load-and-mask@master
|
|
30
|
+
- run: uv sync
|
|
31
|
+
- run: uv run pytest
|
|
32
|
+
|
|
33
|
+
release-please:
|
|
34
|
+
needs: matrix-test
|
|
35
|
+
runs-on: ubuntu-latest
|
|
36
|
+
outputs:
|
|
37
|
+
release_created: ${{ steps.release.outputs.release_created }}
|
|
38
|
+
steps:
|
|
39
|
+
- uses: actions/checkout@v4
|
|
40
|
+
- uses: googleapis/release-please-action@v4
|
|
41
|
+
id: release
|
|
42
|
+
with:
|
|
43
|
+
release-type: python
|
|
44
|
+
token: ${{ secrets.GH_PERSONAL_TOKEN }}
|
|
45
|
+
|
|
46
|
+
build-and-publish:
|
|
47
|
+
needs: release-please
|
|
48
|
+
runs-on: ubuntu-latest
|
|
49
|
+
if: ${{ needs.release-please.outputs.release_created }}
|
|
50
|
+
steps:
|
|
51
|
+
- uses: actions/checkout@v4
|
|
52
|
+
- uses: jdx/mise-action@v2
|
|
53
|
+
- uses: iloveitaly/github-action-direnv-load-and-mask@master
|
|
54
|
+
- run: uv sync
|
|
55
|
+
- run: uv build
|
|
56
|
+
- run: uv publish --token ${{ secrets.PYPI_API_TOKEN }}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
name: Repository Metadata Sync
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main, master]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
repo_sync:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
steps:
|
|
11
|
+
- name: Fetching Local Repository
|
|
12
|
+
uses: actions/checkout@v4
|
|
13
|
+
- name: Repository Metadata Sync
|
|
14
|
+
uses: iloveitaly/github-actions-metadata-sync@main
|
|
15
|
+
with:
|
|
16
|
+
TOKEN: ${{ secrets.GH_PERSONAL_TOKEN }}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
pip-wheel-metadata/
|
|
24
|
+
share/python-wheels/
|
|
25
|
+
*.egg-info/
|
|
26
|
+
.installed.cfg
|
|
27
|
+
*.egg
|
|
28
|
+
MANIFEST
|
|
29
|
+
|
|
30
|
+
# PyInstaller
|
|
31
|
+
# Usually these files are written by a python script from a template
|
|
32
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
33
|
+
*.manifest
|
|
34
|
+
*.spec
|
|
35
|
+
|
|
36
|
+
# Installer logs
|
|
37
|
+
pip-log.txt
|
|
38
|
+
pip-delete-this-directory.txt
|
|
39
|
+
|
|
40
|
+
# Unit test / coverage reports
|
|
41
|
+
htmlcov/
|
|
42
|
+
.tox/
|
|
43
|
+
.nox/
|
|
44
|
+
.coverage
|
|
45
|
+
.coverage.*
|
|
46
|
+
.cache
|
|
47
|
+
nosetests.xml
|
|
48
|
+
coverage.xml
|
|
49
|
+
*.cover
|
|
50
|
+
*.py,cover
|
|
51
|
+
.hypothesis/
|
|
52
|
+
.pytest_cache/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
target/
|
|
76
|
+
|
|
77
|
+
# Jupyter Notebook
|
|
78
|
+
.ipynb_checkpoints
|
|
79
|
+
|
|
80
|
+
# IPython
|
|
81
|
+
profile_default/
|
|
82
|
+
ipython_config.py
|
|
83
|
+
|
|
84
|
+
# pyenv
|
|
85
|
+
.python-version
|
|
86
|
+
|
|
87
|
+
# pipenv
|
|
88
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
89
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
90
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
91
|
+
# install all needed dependencies.
|
|
92
|
+
#Pipfile.lock
|
|
93
|
+
|
|
94
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
|
95
|
+
__pypackages__/
|
|
96
|
+
|
|
97
|
+
# Celery stuff
|
|
98
|
+
celerybeat-schedule
|
|
99
|
+
celerybeat.pid
|
|
100
|
+
|
|
101
|
+
# SageMath parsed files
|
|
102
|
+
*.sage.py
|
|
103
|
+
|
|
104
|
+
# Environments
|
|
105
|
+
.env
|
|
106
|
+
.venv
|
|
107
|
+
env/
|
|
108
|
+
venv/
|
|
109
|
+
ENV/
|
|
110
|
+
env.bak/
|
|
111
|
+
venv.bak/
|
|
112
|
+
|
|
113
|
+
# Spyder project settings
|
|
114
|
+
.spyderproject
|
|
115
|
+
.spyproject
|
|
116
|
+
|
|
117
|
+
# Rope project settings
|
|
118
|
+
.ropeproject
|
|
119
|
+
|
|
120
|
+
# mkdocs documentation
|
|
121
|
+
/site
|
|
122
|
+
|
|
123
|
+
# mypy
|
|
124
|
+
.mypy_cache/
|
|
125
|
+
.dmypy.json
|
|
126
|
+
dmypy.json
|
|
127
|
+
|
|
128
|
+
# Pyre type checker
|
|
129
|
+
.pyre/
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"[python]": {
|
|
3
|
+
"editor.formatOnSave": true,
|
|
4
|
+
"editor.defaultFormatter": "charliermarsh.ruff",
|
|
5
|
+
"editor.codeActionsOnSave": {
|
|
6
|
+
"source.fixAll": "explicit",
|
|
7
|
+
"source.organizeImports": "explicit"
|
|
8
|
+
},
|
|
9
|
+
"editor.tabSize": 4
|
|
10
|
+
},
|
|
11
|
+
"[toml]": {
|
|
12
|
+
"editor.formatOnSave": true,
|
|
13
|
+
"editor.tabSize": 4
|
|
14
|
+
},
|
|
15
|
+
"python.analysis.autoFormatStrings": true,
|
|
16
|
+
|
|
17
|
+
// for import autosuggest
|
|
18
|
+
"python.analysis.indexing": true,
|
|
19
|
+
"python.analysis.autoImportCompletions": true,
|
|
20
|
+
|
|
21
|
+
"python.analysis.packageIndexDepths": [
|
|
22
|
+
{
|
|
23
|
+
"name": "",
|
|
24
|
+
"depth": 3,
|
|
25
|
+
"includeAllSymbols": true
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
|
|
29
|
+
"cSpell.words": ["openai", "httpx"],
|
|
30
|
+
|
|
31
|
+
"files.exclude": {
|
|
32
|
+
".ruff_cache": true,
|
|
33
|
+
".pytest_cache": true,
|
|
34
|
+
".venv": true
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.0 (2025-04-14)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add PathPrettifier for structlog path formatting ([b54bc58](https://github.com/iloveitaly/structlog-config/commit/b54bc58ef5d896675a69d809704829b3976763b7))
|
|
9
|
+
* add RenameField processor for log key renaming ([a07bf36](https://github.com/iloveitaly/structlog-config/commit/a07bf363aa97631978c141c7385932f76ac30398))
|
|
10
|
+
* add structured access logging for FastAPI requests ([37d506d](https://github.com/iloveitaly/structlog-config/commit/37d506dec89fc9c0de6a548371724c2342c0bafc))
|
|
11
|
+
* allow loggers to be configured from environment variables ([417acf1](https://github.com/iloveitaly/structlog-config/commit/417acf1b9f5c0219191486c26ccdf6959956f329))
|
|
12
|
+
* configure loggers via env variables in env_config.py ([2b920c4](https://github.com/iloveitaly/structlog-config/commit/2b920c4b0c373aabcb6b7d31503205268308ed83))
|
|
13
|
+
* debug log static asset requests in FastAPI logger ([d8e5ee0](https://github.com/iloveitaly/structlog-config/commit/d8e5ee01af6b4ad5027010bf459fddf55263c8fc))
|
|
14
|
+
* determine which optional packages are installed ([7e062e2](https://github.com/iloveitaly/structlog-config/commit/7e062e2a50902ce53295730d8ad69faa387b1997))
|
|
15
|
+
* improve CI workflow and project setup ([2338dd0](https://github.com/iloveitaly/structlog-config/commit/2338dd06ed1c044123a11f5cc08278130da31d21))
|
|
16
|
+
* update logger config for testing and add is_pytest function ([fe579ca](https://github.com/iloveitaly/structlog-config/commit/fe579ca8c0210934ca7d85294b6d3b5a1d567c68))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
* dynamically pull the LOG_LEVEL from env for testing ([0cceb7c](https://github.com/iloveitaly/structlog-config/commit/0cceb7c541bd3f2d03ccf71392ee56ba5ae7f0bd))
|
|
22
|
+
* ensure copier uses current HEAD for updates ([20b9f9d](https://github.com/iloveitaly/structlog-config/commit/20b9f9d64f7c09d22d149162af332954cad5d070))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Documentation
|
|
26
|
+
|
|
27
|
+
* add comments to middleware and formatter functions ([bf43006](https://github.com/iloveitaly/structlog-config/commit/bf43006ad538aa9e369c9a9fa251161feee0ea77))
|
|
28
|
+
* add FastAPI access logger section to README.md ([93c6d98](https://github.com/iloveitaly/structlog-config/commit/93c6d98e5441f6f4c5e69dc9c618dfcfb556e7f4))
|
|
29
|
+
* elaborate on FastAPI Access Logger usage and benefits ([aa4223e](https://github.com/iloveitaly/structlog-config/commit/aa4223e9db3726d5c12e699116ab84063103765b))
|
|
30
|
+
* update project description and keywords in pyproject.toml ([6424d8a](https://github.com/iloveitaly/structlog-config/commit/6424d8a440d474a8feb4c8ddff322b2e17241126))
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
setup:
|
|
2
|
+
uv venv && uv sync
|
|
3
|
+
@echo "activate: source ./.venv/bin/activate"
|
|
4
|
+
|
|
5
|
+
clean:
|
|
6
|
+
rm -rf *.egg-info
|
|
7
|
+
rm -rf .venv
|
|
8
|
+
|
|
9
|
+
update_copier:
|
|
10
|
+
uv tool run --with jinja2_shell_extension \
|
|
11
|
+
copier@latest update --vcs-ref=HEAD --trust --skip-tasks --skip-answered
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: structlog-config
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A comprehensive structlog configuration with sensible defaults for development and production environments, featuring context management, exception formatting, and path prettification.
|
|
5
|
+
Project-URL: Repository, https://github.com/iloveitaly/structlog-config
|
|
6
|
+
Author-email: Michael Bianco <mike@mikebian.co>
|
|
7
|
+
Keywords: json-logging,logging,structlog,structured-logging
|
|
8
|
+
Requires-Python: >=3.10
|
|
9
|
+
Requires-Dist: orjson>=3.10.15
|
|
10
|
+
Requires-Dist: python-decouple-typed>=3.11.0
|
|
11
|
+
Requires-Dist: structlog>=25.2.0
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
|
|
14
|
+
# Structlog Configuration
|
|
15
|
+
|
|
16
|
+
Logging is really important:
|
|
17
|
+
|
|
18
|
+
* High performance JSON logging in production
|
|
19
|
+
* All loggers, even plugin or system loggers, should route through the same formatter
|
|
20
|
+
* Structured logging everywhere
|
|
21
|
+
* Ability to easily set thread-local log context
|
|
22
|
+
|
|
23
|
+
## Stdib Log Management
|
|
24
|
+
|
|
25
|
+
Note that `{LOGGER_NAME}` is the name of the system logger assigned via `logging.getLogger(__name__)`:
|
|
26
|
+
|
|
27
|
+
* `OPENAI_LOG_LEVEL`
|
|
28
|
+
* `OPENAI_LOG_PATH`. Ignored in production.
|
|
29
|
+
|
|
30
|
+
## FastAPI Access Logger
|
|
31
|
+
|
|
32
|
+
Structured, simple access log with request timing to replace the default fastapi access log. Why?
|
|
33
|
+
|
|
34
|
+
1. It's less verbose
|
|
35
|
+
2. Uses structured logging params instead of string interpolation
|
|
36
|
+
3. debug level logs any static assets
|
|
37
|
+
|
|
38
|
+
Here's how to use it:
|
|
39
|
+
|
|
40
|
+
1. [Disable fastapi's default logging.](https://github.com/iloveitaly/python-starter-template/blob/f54cb47d8d104987f2e4a668f9045a62e0d6818a/main.py#L55-L56)
|
|
41
|
+
2. [Add the middleware to your FastAPI app.](https://github.com/iloveitaly/python-starter-template/blob/f54cb47d8d104987f2e4a668f9045a62e0d6818a/app/routes/middleware/__init__.py#L63-L65)
|
|
42
|
+
|
|
43
|
+
Adapted from:
|
|
44
|
+
|
|
45
|
+
- https://github.com/iloveitaly/fastapi-logger/blob/main/fastapi_structlog/middleware/access_log.py#L70
|
|
46
|
+
- https://github.com/fastapiutils/fastapi-utils/blob/master/fastapi_utils/timing.py
|
|
47
|
+
- https://pypi.org/project/fastapi-structlog/
|
|
48
|
+
- https://pypi.org/project/asgi-correlation-id/
|
|
49
|
+
- https://gist.github.com/nymous/f138c7f06062b7c43c060bf03759c29e
|
|
50
|
+
- https://github.com/sharu1204/fastapi-structlog/blob/master/app/main.py
|
|
51
|
+
|
|
52
|
+
## Related Projects
|
|
53
|
+
|
|
54
|
+
* https://github.com/underyx/structlog-pretty
|
|
55
|
+
* https://pypi.org/project/httpx-structlog/
|
|
56
|
+
|
|
57
|
+
## References
|
|
58
|
+
|
|
59
|
+
- https://github.com/replicate/cog/blob/2e57549e18e044982bd100e286a1929f50880383/python/cog/logging.py#L20
|
|
60
|
+
- https://github.com/apache/airflow/blob/4280b83977cd5a53c2b24143f3c9a6a63e298acc/task_sdk/src/airflow/sdk/log.py#L187
|
|
61
|
+
- https://github.com/kiwicom/structlog-sentry
|
|
62
|
+
- https://github.com/jeremyh/datacube-explorer/blob/b289b0cde0973a38a9d50233fe0fff00e8eb2c8e/cubedash/logs.py#L40C21-L40C42
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Structlog Configuration
|
|
2
|
+
|
|
3
|
+
Logging is really important:
|
|
4
|
+
|
|
5
|
+
* High performance JSON logging in production
|
|
6
|
+
* All loggers, even plugin or system loggers, should route through the same formatter
|
|
7
|
+
* Structured logging everywhere
|
|
8
|
+
* Ability to easily set thread-local log context
|
|
9
|
+
|
|
10
|
+
## Stdib Log Management
|
|
11
|
+
|
|
12
|
+
Note that `{LOGGER_NAME}` is the name of the system logger assigned via `logging.getLogger(__name__)`:
|
|
13
|
+
|
|
14
|
+
* `OPENAI_LOG_LEVEL`
|
|
15
|
+
* `OPENAI_LOG_PATH`. Ignored in production.
|
|
16
|
+
|
|
17
|
+
## FastAPI Access Logger
|
|
18
|
+
|
|
19
|
+
Structured, simple access log with request timing to replace the default fastapi access log. Why?
|
|
20
|
+
|
|
21
|
+
1. It's less verbose
|
|
22
|
+
2. Uses structured logging params instead of string interpolation
|
|
23
|
+
3. debug level logs any static assets
|
|
24
|
+
|
|
25
|
+
Here's how to use it:
|
|
26
|
+
|
|
27
|
+
1. [Disable fastapi's default logging.](https://github.com/iloveitaly/python-starter-template/blob/f54cb47d8d104987f2e4a668f9045a62e0d6818a/main.py#L55-L56)
|
|
28
|
+
2. [Add the middleware to your FastAPI app.](https://github.com/iloveitaly/python-starter-template/blob/f54cb47d8d104987f2e4a668f9045a62e0d6818a/app/routes/middleware/__init__.py#L63-L65)
|
|
29
|
+
|
|
30
|
+
Adapted from:
|
|
31
|
+
|
|
32
|
+
- https://github.com/iloveitaly/fastapi-logger/blob/main/fastapi_structlog/middleware/access_log.py#L70
|
|
33
|
+
- https://github.com/fastapiutils/fastapi-utils/blob/master/fastapi_utils/timing.py
|
|
34
|
+
- https://pypi.org/project/fastapi-structlog/
|
|
35
|
+
- https://pypi.org/project/asgi-correlation-id/
|
|
36
|
+
- https://gist.github.com/nymous/f138c7f06062b7c43c060bf03759c29e
|
|
37
|
+
- https://github.com/sharu1204/fastapi-structlog/blob/master/app/main.py
|
|
38
|
+
|
|
39
|
+
## Related Projects
|
|
40
|
+
|
|
41
|
+
* https://github.com/underyx/structlog-pretty
|
|
42
|
+
* https://pypi.org/project/httpx-structlog/
|
|
43
|
+
|
|
44
|
+
## References
|
|
45
|
+
|
|
46
|
+
- https://github.com/replicate/cog/blob/2e57549e18e044982bd100e286a1929f50880383/python/cog/logging.py#L20
|
|
47
|
+
- https://github.com/apache/airflow/blob/4280b83977cd5a53c2b24143f3c9a6a63e298acc/task_sdk/src/airflow/sdk/log.py#L187
|
|
48
|
+
- https://github.com/kiwicom/structlog-sentry
|
|
49
|
+
- https://github.com/jeremyh/datacube-explorer/blob/b289b0cde0973a38a9d50233fe0fff00e8eb2c8e/cubedash/logs.py#L40C21-L40C42
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# NOTE some limitations of copier:
|
|
2
|
+
#
|
|
3
|
+
# - any extensions must be installed manually
|
|
4
|
+
# - you cannot use dst_path as default answers
|
|
5
|
+
|
|
6
|
+
_min_copier_version: 9.4.1
|
|
7
|
+
|
|
8
|
+
_answers_file: .copier/.copier-answers.yml
|
|
9
|
+
|
|
10
|
+
_jinja_extensions:
|
|
11
|
+
- jinja2_shell_extension.ShellExtension
|
|
12
|
+
|
|
13
|
+
_message_after_copy: |
|
|
14
|
+
Next steps:
|
|
15
|
+
|
|
16
|
+
1. Customize secrets in .envrc
|
|
17
|
+
2. Run `direnv allow`
|
|
18
|
+
3. Set PYPI_API_TOKEN on GH actions
|
|
19
|
+
4. Set GH_TOKEN on GH actions
|
|
20
|
+
|
|
21
|
+
project_name:
|
|
22
|
+
type: str
|
|
23
|
+
help: Dash separated project slug
|
|
24
|
+
default: "{{ \"basename $(pwd)\" | shell() | trim | regex_replace(' ', '-') | regex_replace('_', '-') }}"
|
|
25
|
+
validator: >-
|
|
26
|
+
{% if not (project_name | regex_search('^[a-z][a-z0-9-_]+$')) %}
|
|
27
|
+
project_name must start with a letter, followed one or more letters, digits or dashes all lowercase.
|
|
28
|
+
{% endif %}
|
|
29
|
+
|
|
30
|
+
# https://github.com/superlinear-ai/substrate/blob/main/copier.yml
|
|
31
|
+
project_name_snake_case:
|
|
32
|
+
when: false
|
|
33
|
+
default: "{{ project_name | lower | replace('-', '_') }}"
|
|
34
|
+
|
|
35
|
+
full_name:
|
|
36
|
+
type: str
|
|
37
|
+
help: Full name of the project owner (for pypi)
|
|
38
|
+
default: "{{ \"git config --global user.name\" | shell() | trim }}"
|
|
39
|
+
|
|
40
|
+
email:
|
|
41
|
+
type: str
|
|
42
|
+
help: Email of the project owner (for pypi)
|
|
43
|
+
default: "{{ \"git config --global user.email\" | shell() | trim }}"
|
|
44
|
+
|
|
45
|
+
github_username:
|
|
46
|
+
type: str
|
|
47
|
+
help: GitHub username of the project owner (for pypi)
|
|
48
|
+
default: "{{ \"gh api user --jq '.login'\" | shell() | trim }}"
|
|
49
|
+
|
|
50
|
+
_exclude:
|
|
51
|
+
- TODO
|
|
52
|
+
- /.git
|
|
53
|
+
- /README.md
|
|
54
|
+
- /CHANGELOG.md
|
|
55
|
+
- /LICENSE
|
|
56
|
+
- /uv.lock
|
|
57
|
+
- /metadata.json
|
|
58
|
+
|
|
59
|
+
_tasks:
|
|
60
|
+
- '[ ! -d .git ] && git init'
|
|
61
|
+
- touch README.md
|
|
62
|
+
- uv sync
|
|
63
|
+
- git add -A
|
|
64
|
+
- git commit -m "🎉 Initial commit"
|
|
65
|
+
# - ["{{ _copier_python }}", .copier/bootstrap.py]
|
|
66
|
+
|
|
67
|
+
# although it's annoying to have the .copier-answers.yml file in the root, it allows `copier update`
|
|
68
|
+
# to work properly
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "structlog-config"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "A comprehensive structlog configuration with sensible defaults for development and production environments, featuring context management, exception formatting, and path prettification."
|
|
5
|
+
keywords = ["logging", "structlog", "json-logging", "structured-logging"]
|
|
6
|
+
readme = "README.md"
|
|
7
|
+
requires-python = ">=3.10"
|
|
8
|
+
dependencies = [
|
|
9
|
+
"orjson>=3.10.15",
|
|
10
|
+
"python-decouple-typed>=3.11.0",
|
|
11
|
+
"structlog>=25.2.0",
|
|
12
|
+
]
|
|
13
|
+
authors = [{ name = "Michael Bianco", email = "mike@mikebian.co" }]
|
|
14
|
+
urls = { "Repository" = "https://github.com/iloveitaly/structlog-config" }
|
|
15
|
+
|
|
16
|
+
[build-system]
|
|
17
|
+
requires = ["hatchling"]
|
|
18
|
+
build-backend = "hatchling.build"
|
|
19
|
+
|
|
20
|
+
[dependency-groups]
|
|
21
|
+
debugging-extras = [
|
|
22
|
+
"colorama>=0.4.6",
|
|
23
|
+
"datamodel-code-generator>=0.28.5",
|
|
24
|
+
"debugpy>=1.8.13",
|
|
25
|
+
"docrepr>=0.2.0",
|
|
26
|
+
"funcy-pipe>=0.11.1",
|
|
27
|
+
"httpdbg>=1.1.2",
|
|
28
|
+
"icecream>=2.1.4",
|
|
29
|
+
"ipdb",
|
|
30
|
+
"ipython>=8.34.0",
|
|
31
|
+
"ipython-autoimport>=0.5.1",
|
|
32
|
+
"ipython-ctrlr-fzf>=0.2.1",
|
|
33
|
+
"ipython-playground>=0.2.0",
|
|
34
|
+
"ipython-suggestions",
|
|
35
|
+
"ipythonclipboard>=1.0b2",
|
|
36
|
+
"jedi>=0.19.2",
|
|
37
|
+
"pdbr[ipython]>=0.9.0",
|
|
38
|
+
"pipdeptree>=2.26.0",
|
|
39
|
+
"pre-commit>=4.2.0",
|
|
40
|
+
"pretty-traceback",
|
|
41
|
+
"pudb>=2024.1.3",
|
|
42
|
+
"py-spy>=0.4.0",
|
|
43
|
+
"pyfzf>=0.3.1",
|
|
44
|
+
"pytest-fzf>=0.1.2.post1",
|
|
45
|
+
"rich>=14.0.0",
|
|
46
|
+
"rpdb>=0.2.0",
|
|
47
|
+
"sqlparse>=0.5.3",
|
|
48
|
+
"uv-development-toggle>=0.4.0",
|
|
49
|
+
]
|
|
50
|
+
dev = ["fastapi>=0.115.12", "httpx>=0.28.1", "pytest>=8.3.3"]
|
|
51
|
+
|
|
52
|
+
[tool.uv.sources]
|
|
53
|
+
ipdb = { git = "https://github.com/iloveitaly/ipdb", rev = "support-executables" }
|
|
54
|
+
pdbr = { git = "https://github.com/iloveitaly/pdbr", rev = "ipython-9.x" }
|
|
55
|
+
pretty-traceback = { git = "https://github.com/iloveitaly/pretty-traceback.git", rev = "custom" }
|
|
56
|
+
ipython-suggestions = { git = "https://github.com/iloveitaly/ipython-suggestions.git", rev = "ipython-9.x" }
|