Skip to content

Commit

Permalink
Add more explanation regarding umask
Browse files Browse the repository at this point in the history
  • Loading branch information
Delgan committed Sep 3, 2023
1 parent 40693c2 commit bba73d9
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docs/resources/recipes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Code snippets and recipes for ``loguru``
.. |contextlib.redirect_stdout| replace:: :func:`contextlib.redirect_stdout`
.. |copy.deepcopy| replace:: :func:`copy.deepcopy`
.. |os.fork| replace:: :func:`os.fork`
.. |os.umask| replace:: :func:`os.umask`
.. |multiprocessing| replace:: :mod:`multiprocessing`
.. |pickle| replace:: :mod:`pickle`
.. |traceback| replace:: :mod:`traceback`
Expand Down Expand Up @@ -464,6 +465,8 @@ To set desired permissions on created log files, use the ``opener`` argument to

When using an opener argument, all created log files including ones created during rotation will use the initially provided opener.

Note that the provided mode will be masked out by the OS `umask <https://en.wikipedia.org/wiki/Umask>`_ value (describing which bits are *not* to be set when creating a file or directory). This value is conventionally equals to ``0o022``, which means specifying a ``0o666`` mode will result in a ``0o666 - 0o022 = 0o644`` file permission in this case (which is actually the default). It is possible to change the umask value by first calling |os.umask|, but this needs to be done with careful consideration, as it changes the value globally and can cause security issues.


Preserving an ``opt()`` parameter for the whole module
------------------------------------------------------
Expand Down

0 comments on commit bba73d9

Please sign in to comment.