File tree Expand file tree Collapse file tree 7 files changed +17
-23
lines changed Expand file tree Collapse file tree 7 files changed +17
-23
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
55The format is based on [ Keep a Changelog] ( http://keepachangelog.com/ )
66and this project adheres to [ Semantic Versioning] ( http://semver.org/ ) .
77
8+ ## [ 0.1.1] (2023-04-25)
9+
10+ - renamed to secure_logger
11+
812## [ 0.1.0] (2023-04-14)
913
1014- initial release
Original file line number Diff line number Diff line change 33# -------------------------------------------------------------------------
44.PHONY : build requirements deps-update deps-init
55
6- django-server :
7- ./manage.py runserver 0.0.0.0:8000
8-
9- django-shell :
10- ./manage.py shell_plus
11-
12-
13- django-test :
14- ./manage.py test
15-
166requirements :
177 pre-commit autoupdate
188 python -m pip install --upgrade pip wheel
Original file line number Diff line number Diff line change @@ -31,13 +31,13 @@ pip install secure-logger
3131## Usage
3232
3333``` python
34- from secure_logger.decorators import app_logger
34+ from secure_logger.decorators import secure_logger
3535
3636MY_SENSITIVE_KEYS = [" top-secret-password" , " equally-secret-value" ,]
3737
3838class TestClass (object ):
3939
40- @app_logger (sensitive_keys = MY_SENSITIVE_KEYS , indent = 4 )
40+ @secure_logger (sensitive_keys = MY_SENSITIVE_KEYS , indent = 4 )
4141 def test_2 (self , test_dict , test_list ):
4242 pass
4343
@@ -51,10 +51,10 @@ o = TestClass()
5151o.test_2(test_dict = test_dict, test_list = test_list)
5252```
5353
54- Output
54+ Generates log entries of this style and form:
5555
5656``` log
57- INFO:app_logger : __main__.TestClass().test_2() keyword args: {
57+ INFO:secure_logger : __main__.TestClass().test_2() keyword args: {
5858 "test_dict": {
5959 "insensitive_key": "you-can-see-me",
6060 "top-secret-password": "*** -- REDACTED -- ***",
Original file line number Diff line number Diff line change 77
88# Increment this version number to trigger a new release. See
99# CHANGELOG.md for information on the versioning scheme.
10- __version__ = "0.1.0 "
10+ __version__ = "0.1.1 "
1111
1212# The app name will be used to define the name of the default plugin root and
1313# plugin directory. To avoid conflicts between multiple locally-installed
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ build-backend = "setuptools.build_meta:__legacy__"
2424# ------------------------------------------------------------------------------
2525[project ]
2626name = " secure-logger"
27- version = " 0.1.0 "
27+ version = " 0.1.1 "
2828authors = [
2929 {
name =
" Lawrence McDaniel" ,
email =
" [email protected] " }
3030]
Original file line number Diff line number Diff line change 1212logger = logging .getLogger (__name__ )
1313
1414
15- def app_logger (sensitive_keys : list = DEFAULT_SENSITIVE_KEYS , indent : int = 4 ):
15+ def secure_logger (sensitive_keys : list = DEFAULT_SENSITIVE_KEYS , indent : int = 4 ):
1616 """Top level decorator, for defining input parameters."""
1717
1818 def decorate (func ):
@@ -23,7 +23,7 @@ def decorate(func):
2323 its positional arguments, and keyword pairs presented as a formatted dict.
2424
2525 Sample output:
26- 2022-07-08 19:40:51,085 INFO app_logger : courses.views.CourseListingView().get_queryset()
26+ 2022-07-08 19:40:51,085 INFO secure_logger : courses.views.CourseListingView().get_queryset()
2727 """
2828
2929 @wraps (func )
@@ -65,7 +65,7 @@ def wrapper(*args, **kwargs):
6565 kwargs_dict_repr += serialized_masked_dict (kwargs , sensitive_keys = sensitive_keys , indent = indent )
6666
6767 logger .info (
68- "app_logger : {name_spec} {args} {kwargs}" .format (
68+ "secure_logger : {name_spec} {args} {kwargs}" .format (
6969 name_spec = name_spec ,
7070 args = positional_args if len (positional_args ) > 0 else "" ,
7171 kwargs = kwargs_dict_repr ,
Original file line number Diff line number Diff line change 66"""
77import logging
88
9- from secure_logger .decorators import app_logger
9+ from secure_logger .decorators import secure_logger
1010
1111logging .basicConfig (level = logging .DEBUG )
1212
1818]
1919
2020
21- @app_logger (sensitive_keys = MY_SENSITIVE_KEYS , indent = 4 )
21+ @secure_logger (sensitive_keys = MY_SENSITIVE_KEYS , indent = 4 )
2222def test_1 (msg ):
2323 """Test 1: a simple module function."""
2424 print ("test 1: " + msg ) # noqa: T201
@@ -27,13 +27,13 @@ def test_1(msg):
2727class TestClass (object ):
2828 """Test class method logging."""
2929
30- @app_logger ()
30+ @secure_logger ()
3131 def test_2 (self , test_dict , test_list ):
3232 """Test class input parameter as objects."""
3333 pass
3434
3535
36- @app_logger ()
36+ @secure_logger ()
3737class Test3 :
3838 """Test 3: decorate a class."""
3939
You can’t perform that action at this time.
0 commit comments