Skip to content

Commit 0ee6b9a

Browse files
committed
Maintain backwards compatibility
1 parent 0d2bc65 commit 0ee6b9a

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "python-json-logger"
7-
version = "4.0.0.dev1"
7+
version = "3.1.0.dev1"
88
description = "JSON Log Formatter for the Python Logging Package"
99
authors = [
1010
{name = "Zakaria Zajac", email = "zak@madzak.com"},

src/pythonjsonlogger/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44

55
## Standard Library
66
import sys
7+
import warnings
78

89
## Installed
910

1011
## Application
12+
import pythonjsonlogger.json
1113

1214
### CONSTANTS
1315
### ============================================================================
@@ -22,3 +24,15 @@
2224
ORJSON_AVAILABLE = True
2325
except ImportError:
2426
ORJSON_AVAILABLE = False
27+
28+
29+
### DEPRECATED COMPATIBILITY
30+
### ============================================================================
31+
def __getattr__(name: str):
32+
if name == "jsonlogger":
33+
warnings.warn(
34+
"pythonjsonlogger.jsonlogger has been moved to pythonjsonlogger.json",
35+
DeprecationWarning,
36+
)
37+
return pythonjsonlogger.json
38+
raise AttributeError(f"module {__name__} has no attribute {name}")

0 commit comments

Comments
 (0)