Skip to content

Commit

Permalink
Use standard logging config
Browse files Browse the repository at this point in the history
Move config env handling and logging to package init
  • Loading branch information
NeonDaniel committed Dec 11, 2023
1 parent 5e191d1 commit 3d89414
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
9 changes: 9 additions & 0 deletions docker_overlay/etc/neon/neon.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,12 @@ location:
name: Pacific Standard Time
dstOffset: 3600000
offset: -28800000

logs:
name: iris
level: INFO
level_overrides:
error:
- pika
warning:
- filelock
7 changes: 7 additions & 0 deletions neon_iris/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,10 @@
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

from os import environ
from neon_utils.log_utils import init_log

environ.setdefault("OVOS_CONFIG_BASE_FOLDER", "neon")
environ.setdefault("OVOS_CONFIG_FILENAME", "diana.yaml")
init_log(log_name="iris")
5 changes: 0 additions & 5 deletions neon_iris/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@

import click

from os import environ
from os.path import expanduser, isfile
from time import sleep
from click_default_group import DefaultGroup
Expand All @@ -38,10 +37,6 @@
from neon_iris.util import load_config_file
from neon_iris.version import __version__

environ.setdefault("OVOS_CONFIG_BASE_FOLDER", "neon")
environ.setdefault("OVOS_CONFIG_FILENAME", "diana.yaml")
# TODO: Define default config file from this package


def _print_config():
from ovos_config.config import Configuration
Expand Down
2 changes: 0 additions & 2 deletions neon_iris/web_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ def __init__(self, lang: str = None):
makedirs(self._audio_path)
self.default_lang = lang or self.config.get('default_lang')
self.chat_ui = gradio.Blocks()
LOG.name = "iris"
LOG.init(self.config.get("logs"))

def get_lang(self, session_id: str):
if session_id and session_id in self._profiles:
Expand Down

0 comments on commit 3d89414

Please sign in to comment.