Skip to content

Commit

Permalink
proper logging with loki
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinRovang committed Jul 27, 2023
1 parent 8775b00 commit 0a2b14a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions central_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
import numpy as np
from beartype.typing import Dict, Optional, Any, NoReturn
from loguru import logger
import sys

from utils.helpers import timer
from config import config
from neotemplate.base_central_processing import CPNeoTemplate


logger.add(sys.stdout, format=" level={level} | {time:YYYY-MM-DD at HH:mm:ss} | {message}", level="INFO")

class CentralProcessing(CPNeoTemplate):
"""
Central processing unit for preprocessing, postprocessing, predicting and training.
Expand Down
3 changes: 3 additions & 0 deletions neotemplate/base_central_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@
import yaml
import toml
import requests
import sys

from config import config as cfg

logger.add(sys.stdout, format=" level={level} | {time:YYYY-MM-DD at HH:mm:ss} | {message}", level="INFO")


class CPNeoTemplate(nn.Module):
"""Central processing unit for the NeoTemplate."""
Expand Down
3 changes: 3 additions & 0 deletions utils/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
from functools import wraps
from time import time
from loguru import logger
import sys

logger.add(sys.stdout, format=" level={level} | {time:YYYY-MM-DD at HH:mm:ss} | {message}", level="INFO")


def timer(orig_func: Callable):
Expand Down

0 comments on commit 0a2b14a

Please sign in to comment.