Skip to content

Commit

Permalink
[Version] v2.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Herklos committed Oct 4, 2020
1 parent ab4f19b commit 7102188
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 13 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.0.1] - 2020-10-01
### Added
- Logging dynamic implementation

## [2.0.0] - 2020-10-01
### Update
- Project name to 'channel'
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Channel [2.0.0](https://github.com/Drakkar-Software/channel/blob/master/CHANGELOG.md)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/d6bc3f05475c463189dbd509cfc94afe)](https://app.codacy.com/gh/Drakkar-Software/channel?utm_source=github.com&utm_medium=referral&utm_content=Drakkar-Software/channel&utm_campaign=Badge_Grade_Dashboard)
# Channel [2.0.1](https://github.com/Drakkar-Software/channel/blob/master/CHANGELOG.md)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/523d43c62f1d4de08395752367f5fddc)](https://www.codacy.com/gh/Drakkar-Software/channel/dashboard?utm_source=github.com&utm_medium=referral&utm_content=Drakkar-Software/channel&utm_campaign=Badge_Grade)
[![PyPI](https://img.shields.io/pypi/v/channel.svg)](https://pypi.python.org/pypi/channel/)
[![Build Status](https://api.travis-ci.com/Drakkar-Software/channel.svg?branch=master)](https://travis-ci.com/Drakkar-Software/channel)
[![Build Status](https://dev.azure.com/drakkarsoftware/channel/_apis/build/status/Drakkar-Software.channel?branchName=master)](https://dev.azure.com/drakkarsoftware/channel/_build/latest?definitionId=3&branchName=master)
[![Build Status](https://cloud.drone.io/api/badges/Drakkar-Software/channel/status.svg)](https://cloud.drone.io/Drakkar-Software/channel)
[![Coverage Status](https://coveralls.io/repos/github/Drakkar-Software/channel/badge.svg?branch=master)](https://coveralls.io/github/Drakkar-Software/channel?branch=master)
[![Coverage Status](https://coveralls.io/repos/github/Drakkar-Software/OctoBot-Channels/badge.svg?branch=master)](https://coveralls.io/github/Drakkar-Software/OctoBot-Channels?branch=master)
[![Doc Status](https://readthedocs.org/projects/octobot-channels/badge/?version=stable)](https://octobot-channels.readthedocs.io/en/stable/?badge=stable)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

[OctoBot](https://github.com/Drakkar-Software/OctoBot) channels package.
Python multi-task communication library. Used by [OctoBot](https://github.com/Drakkar-Software/OctoBot) project.

## Installation
With python3 : `pip install channel`
Expand Down
2 changes: 1 addition & 1 deletion channel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
)

PROJECT_NAME = "channel"
VERSION = "2.0.0" # major.minor.revision
VERSION = "2.0.1" # major.minor.revision

__all__ = [
"CHANNEL_WILDCARD",
Expand Down
4 changes: 2 additions & 2 deletions channel/channels/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
Defines the channel core class : Channel
"""
import typing
import logging

import channel.util.logging_util as logging
import channel.enums
import channel.channels.channel_instances as channel_instances

Expand All @@ -45,7 +45,7 @@ class Channel:
DEFAULT_PRIORITY_LEVEL = channel.enums.ChannelConsumerPriorityLevels.HIGH.value

def __init__(self):
self.logger = logging.getLogger(self.__class__.__name__)
self.logger = logging.get_logger(self.__class__.__name__)

# Channel unique id
self.chan_id = None
Expand Down
4 changes: 2 additions & 2 deletions channel/channels/channel_instances.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"""
This module defines created Channels interaction methods
"""
import logging
import channel.util.logging_util as logging


class ChannelInstances:
Expand Down Expand Up @@ -108,6 +108,6 @@ def del_chan_at_id(chan_name, chan_id) -> None:
try:
ChannelInstances.instance().channels[chan_id].pop(chan_name, None)
except KeyError:
logging.getLogger(ChannelInstances.__name__).warning(
logging.get_logger(ChannelInstances.__name__).warning(
f"Can't del chan {chan_name} with chan_id: {chan_id}"
)
4 changes: 2 additions & 2 deletions channel/consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
Define channel Consumer class
"""
import asyncio
import logging

import channel.util.logging_util as logging
import channel.enums


Expand All @@ -36,7 +36,7 @@ def __init__(
size: int = channel.constants.DEFAULT_QUEUE_SIZE,
priority_level: int = channel.enums.ChannelConsumerPriorityLevels.HIGH.value,
):
self.logger = logging.getLogger(self.__class__.__name__)
self.logger = logging.get_logger(self.__class__.__name__)

# Consumer data queue. It contains producer's work (received through Producer.send()).
self.queue = asyncio.Queue(maxsize=size)
Expand Down
5 changes: 3 additions & 2 deletions channel/producer.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
Define channel Producer class
"""
import asyncio
import logging

import channel.util.logging_util as logging


class Producer:
Expand All @@ -31,7 +32,7 @@ class Producer:
"""

def __init__(self, channel):
self.logger = logging.getLogger(self.__class__.__name__)
self.logger = logging.get_logger(self.__class__.__name__)

# Related channel instance
self.channel = channel
Expand Down
33 changes: 33 additions & 0 deletions channel/util/logging_util.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Drakkar-Software channel
# Copyright (c) Drakkar-Software, All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 3.0 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library.
"""
Define channel logger implementation
"""
import logging


# pylint: disable=no-member, import-outside-toplevel
def get_logger(name: str = "") -> logging.Logger:
"""
:param name: the logger name
:return: the logger implementation, can be octobot_commons one or default python logging
"""
try:
import octobot_commons.logging as common_logging

return common_logging.get_logger(logger_name=name)
except ImportError:
return logging.getLogger(name)

0 comments on commit 7102188

Please sign in to comment.