Skip to content

Commit

Permalink
Merge branch 'main' into issue-634
Browse files Browse the repository at this point in the history
  • Loading branch information
hynek authored Dec 15, 2024
2 parents ca39a45 + e51f347 commit 6f3a3df
Show file tree
Hide file tree
Showing 14 changed files with 45 additions and 34 deletions.
16 changes: 9 additions & 7 deletions .github/workflows/zizmor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ on:
permissions:
contents: read


jobs:
zizmor:
name: Zizmor latest via Cargo
name: Zizmor latest via PyPI
runs-on: ubuntu-latest
permissions:
security-events: write
Expand All @@ -21,12 +22,13 @@ jobs:
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Get zizmor
run: cargo install zizmor
- name: Run zizmor
run: zizmor --format sarif . > results.sarif
- uses: hynek/setup-cached-uv@v2

- name: Run zizmor 🌈
run: uvx zizmor --format sarif . > results.sarif
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ci:

repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.3
rev: v0.8.1
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ for sponsor in tomllib.loads(pathlib.Path("pyproject.toml").read_text())["tool"]
<a href="https://www.variomedia.de/"><img title="Variomedia AG" src="docs/_static/sponsors/Variomedia.svg" width="190" /></a>
<a href="https://tidelift.com/?utm_source=lifter&utm_medium=referral&utm_campaign=hynek"><img title="Tidelift" src="docs/_static/sponsors/Tidelift.svg" width="190" /></a>
<a href="https://klaviyo.com/"><img title="Klaviyo" src="docs/_static/sponsors/Klaviyo.svg" width="190" /></a>
<a href="https://www.emsys-renewables.com/"><img title="emsys renewables" src="docs/_static/sponsors/emsys-renewables.svg" width="190" /></a>
<a href="https://filepreviews.io/"><img title="FilePreviews" src="docs/_static/sponsors/FilePreviews.svg" width="190" /></a>
<a href="https://polar.sh/"><img title="Polar" src="docs/_static/sponsors/Polar.svg" width="190" /></a>
<!-- [[[end]]] -->
Expand Down
1 change: 1 addition & 0 deletions docs/_static/sponsors/emsys-renewables.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ for sponsor in tomllib.loads(pathlib.Path("pyproject.toml").read_text())["tool"]
<a href="https://www.variomedia.de/"><img title="Variomedia AG" src="_static/sponsors/Variomedia.svg" width="190" /></a>
<a href="https://tidelift.com/?utm_source=lifter&utm_medium=referral&utm_campaign=hynek"><img title="Tidelift" src="_static/sponsors/Tidelift.svg" width="190" /></a>
<a href="https://klaviyo.com/"><img title="Klaviyo" src="_static/sponsors/Klaviyo.svg" width="190" /></a>
<a href="https://www.emsys-renewables.com/"><img title="emsys renewables" src="_static/sponsors/emsys-renewables.svg" width="190" /></a>
<a href="https://filepreviews.io/"><img title="FilePreviews" src="_static/sponsors/FilePreviews.svg" width="190" /></a>
<a href="https://polar.sh/"><img title="Polar" src="_static/sponsors/Polar.svg" width="190" /></a>
<!-- [[[end]]] -->
Expand Down
2 changes: 1 addition & 1 deletion docs/why.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ There are [plenty of processors](structlog.processors) for most common tasks com
Since each log entry is a dictionary, it can be formatted to **any** format:

- A colorful key-value format for [local development](console-output.md),
- [JSON](structlog.processors.JSONRenderer) of [*logfmt*](structlog.processors.LogfmtRenderer) for easy parsing,
- [JSON](structlog.processors.JSONRenderer) or [*logfmt*](structlog.processors.LogfmtRenderer) for easy parsing,
- or some standard format you have parsers for like *nginx* or Apache *httpd*.

Internally, formatters are processors whose return value (usually a string) is passed into loggers that are responsible for the output of your message.
Expand Down
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,11 @@ title = "Klaviyo"
url = "https://klaviyo.com/"
img = "Klaviyo.svg"

[[tool.sponcon.sponsors]]
title = "emsys renewables"
url = "https://www.emsys-renewables.com/"
img = "emsys-renewables.svg"

[[tool.sponcon.sponsors]]
title = "FilePreviews"
url = "https://filepreviews.io/"
Expand Down
18 changes: 9 additions & 9 deletions src/structlog/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,23 +61,25 @@
"BoundLoggerBase",
"BytesLogger",
"BytesLoggerFactory",
"configure_once",
"DropEvent",
"PrintLogger",
"PrintLoggerFactory",
"ReturnLogger",
"ReturnLoggerFactory",
"WriteLogger",
"WriteLoggerFactory",
"configure",
"configure_once",
"contextvars",
"dev",
"DropEvent",
"getLogger",
"get_config",
"get_context",
"get_logger",
"getLogger",
"is_configured",
"make_filtering_bound_logger",
"PrintLogger",
"PrintLoggerFactory",
"processors",
"reset_defaults",
"ReturnLogger",
"ReturnLoggerFactory",
"stdlib",
"testing",
"threadlocal",
Expand All @@ -86,8 +88,6 @@
"types",
"typing",
"wrap_logger",
"WriteLogger",
"WriteLoggerFactory",
]


Expand Down
2 changes: 1 addition & 1 deletion src/structlog/_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ class BytesLogger:
.. versionadded:: 20.2.0
"""

__slots__ = ("_file", "_write", "_flush", "_lock")
__slots__ = ("_file", "_flush", "_lock", "_write")

def __init__(self, file: BinaryIO | None = None):
self._file = file or sys.stdout.buffer
Expand Down
2 changes: 1 addition & 1 deletion src/structlog/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@

__all__ = [
"ConsoleRenderer",
"better_traceback",
"plain_traceback",
"rich_traceback",
"better_traceback",
]

_IS_WINDOWS = sys.platform == "win32"
Expand Down
8 changes: 4 additions & 4 deletions src/structlog/processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,19 @@

__all__ = [
"NAME_TO_LEVEL", # some people rely on it being here
"add_log_level",
"CallsiteParameter",
"CallsiteParameterAdder",
"dict_tracebacks",
"EventRenamer",
"ExceptionPrettyPrinter",
"format_exc_info",
"JSONRenderer",
"KeyValueRenderer",
"StackInfoRenderer",
"TimeStamper",
"UnicodeDecoder",
"UnicodeEncoder",
"add_log_level",
"dict_tracebacks",
"format_exc_info",
]


Expand Down Expand Up @@ -476,7 +476,7 @@ class TimeStamper:
.. versionchanged:: 19.2.0 Can be pickled now.
"""

__slots__ = ("_stamper", "fmt", "utc", "key")
__slots__ = ("_stamper", "fmt", "key", "utc")

def __init__(
self,
Expand Down
14 changes: 7 additions & 7 deletions src/structlog/stdlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@


__all__ = [
"add_log_level_number",
"add_log_level",
"add_logger_name",
"ExtraAdder",
"BoundLogger",
"filter_by_level",
"get_logger",
"ExtraAdder",
"LoggerFactory",
"PositionalArgumentsFormatter",
"ProcessorFormatter",
"add_log_level",
"add_log_level_number",
"add_logger_name",
"filter_by_level",
"get_logger",
"recreate_defaults",
"render_to_log_kwargs",
]
Expand Down Expand Up @@ -521,7 +521,7 @@ class AsyncBoundLogger:
Callsite parameters are now also collected for async log methods.
"""

__slots__ = ("sync_bl", "_loop")
__slots__ = ("_loop", "sync_bl")

#: The wrapped synchronous logger. It is useful to be able to log
#: synchronously occasionally.
Expand Down
6 changes: 3 additions & 3 deletions src/structlog/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@


__all__ = (
"WrappedLogger",
"BindableLogger",
"Context",
"EventDict",
"Processor",
"ExcInfo",
"ExceptionRenderer",
"ExceptionTransformer",
"BindableLogger",
"FilteringBoundLogger",
"Processor",
"WrappedLogger",
)
1 change: 1 addition & 0 deletions tests/typing/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

def bytes_dumps(
__obj: Any,
/,
default: Callable[[Any], Any] | None = None,
option: int | None = None,
) -> bytes:
Expand Down

0 comments on commit 6f3a3df

Please sign in to comment.