Skip to content

Commit

Permalink
Merge pull request #44 from openweathermap/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
matveyvarg authored Apr 3, 2024
2 parents 3ae7933 + a96839b commit f88342e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion deker/locks.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ def check_existing_lock(self, func_args: Sequence, func_kwargs: Dict) -> None:
# Iterate over Arrays in VArray and try to lock them. If locking fails - wait.
# If it fails again - release all locks.
currently_locked = self.check_arrays_locks(arrays_positions, adapter, varray)
if not currently_locked and (len(self.locks) == len(arrays_positions)):
if not currently_locked:
# Release array locks
return

Expand Down
11 changes: 5 additions & 6 deletions deker/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,18 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

import logging
import os

from logging import Logger
from typing import Optional


_ROOT_DEKER_LOGGER_NAME = "Deker"
_level = os.getenv("DEKER_LOGLEVEL", "WARNING")

format_string = "%(levelname)s | %(asctime)s | %(name)s | %(message)s"
fmter = logging.Formatter(fmt=format_string)

_logger = logging.getLogger(_ROOT_DEKER_LOGGER_NAME)
_logger.propagate = False
_handler = logging.StreamHandler()
_handler.setFormatter(fmter)
_logger.addHandler(_handler)
Expand All @@ -34,10 +33,10 @@
class SelfLoggerMixin(object):
"""Mixin with a logger object with a possibility to log its actions."""

__logger: Logger = None
__logger: Optional[logging.Logger] = None

@property
def logger(self) -> Logger:
def logger(self) -> logging.Logger:
"""Lazy deker logger property."""
if not self.__logger:
self.__logger = _logger.getChild(self.__class__.__name__)
Expand Down

0 comments on commit f88342e

Please sign in to comment.