Skip to content

Commit

Permalink
Changed logger name from "filelock._api" to "filelock" (#97)
Browse files Browse the repository at this point in the history
  • Loading branch information
hkennyv authored Oct 2, 2021
1 parent c9b6d90 commit 676d62f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,13 @@ with lock:
# And released here.
```

All log messages by this library are made using the *DEBUG* level, under the
`filelock` name. On how to control displaying/hiding that please consult the
[logging documentation of the standard library](https://docs.python.org/3/howto/logging.html).

E.g. to hide these messages you can use
`logging.getLogger("filelock").setLevel(logging.INFO)`.


## FileLock vs SoftFileLock

Expand Down
3 changes: 2 additions & 1 deletion src/filelock/_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

from ._error import Timeout

_LOGGER = logging.getLogger(__name__)
_LOGGER = logging.getLogger("filelock")
_LOGGER.setLevel(logging.DEBUG)


# This is a helper class which is returned by :meth:`BaseFileLock.acquire` and wraps the lock to make sure __enter__
Expand Down
1 change: 1 addition & 0 deletions tests/test_filelock.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def test_simple(lock_type, tmp_path, caplog):
"Lock {} released on {}".format(id(lock), lock_path),
]
assert [r.levelno for r in caplog.records] == [logging.DEBUG, logging.DEBUG, logging.DEBUG, logging.DEBUG]
assert [r.name for r in caplog.records] == ["filelock", "filelock", "filelock", "filelock"]


@contextmanager
Expand Down

0 comments on commit 676d62f

Please sign in to comment.