Skip to content

Commit 676d62f

Browse files
authored
Changed logger name from "filelock._api" to "filelock" (#97)
1 parent c9b6d90 commit 676d62f

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,13 @@ with lock:
111111
# And released here.
112112
```
113113

114+
All log messages by this library are made using the *DEBUG* level, under the
115+
`filelock` name. On how to control displaying/hiding that please consult the
116+
[logging documentation of the standard library](https://docs.python.org/3/howto/logging.html).
117+
118+
E.g. to hide these messages you can use
119+
`logging.getLogger("filelock").setLevel(logging.INFO)`.
120+
114121

115122
## FileLock vs SoftFileLock
116123

src/filelock/_api.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
from ._error import Timeout
66

7-
_LOGGER = logging.getLogger(__name__)
7+
_LOGGER = logging.getLogger("filelock")
8+
_LOGGER.setLevel(logging.DEBUG)
89

910

1011
# This is a helper class which is returned by :meth:`BaseFileLock.acquire` and wraps the lock to make sure __enter__

tests/test_filelock.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ def test_simple(lock_type, tmp_path, caplog):
3030
"Lock {} released on {}".format(id(lock), lock_path),
3131
]
3232
assert [r.levelno for r in caplog.records] == [logging.DEBUG, logging.DEBUG, logging.DEBUG, logging.DEBUG]
33+
assert [r.name for r in caplog.records] == ["filelock", "filelock", "filelock", "filelock"]
3334

3435

3536
@contextmanager

0 commit comments

Comments
 (0)