Nemanja Zdravkovic

22 papers Journal 5Unranked 13
YearRankTypeTitle / Venue / Authors
2026 J jnl
Univers. Access Inf. Soc.
Emilija Kisic, Miroslava Raspopovic Milic, Jovana Jovic, Nemanja Zdravkovic
2025 ed.
BISEC
Nemanja Zdravkovic, Dragan Domazet, Sonsoles López-Pernas, Miguel Ángel Conde, Ponnusamy Vijayakumar
2024 J jnl
IEEE Access
D. Saveetha, G. Maragatham, Vijayakumar Ponnusamy, Nemanja Zdravkovic
2024 conf
eLearning
Nikola Dimitrijevic, Mladen Opacic, Sergej Kubat, Nemanja Zdravkovic
2024 conf
eLearning
Emilija Kisic, Miroslava Raspopovic Milic, Jovana Jovic, Nemanja Zdravkovic, Faruk Selimovic
2024 conf
BISEC
Bhavani Adikesavan, Vijayakumar Ponnusamy, Suad Suljovic, Petar Pejic, Nemanja Zdravkovic
2024 conf
eLearning
Nikola Dimitrijevic, Nemanja Zdravkovic, Vijayakumar Ponnusamy
2024 conf
BISEC
Tamara Vukadinovic, Andela Grujic, Marko Goricek, Jovana Jovic, Milan Tancic, Nemanja Zdravkovic
2024 ed.
BISEC
Nemanja Zdravkovic, Dragan Domazet, Sonsoles López-Pernas, Miguel Ángel Conde, Ponnusamy Vijayakumar
2023 conf
BISEC
Nikola Dimitrijevic, Nemanja Zdravkovic, Milena Bogdanovic, Aleksandar M. Mesterovic
2023 conf
eLearning
Nemanja Zdravkovic, Nikola Dimitrijevic
2023 conf
eLearning
Nikola Dimitrijevic, Nemanja Zdravkovic, Milena Bogdanovic
2023 ed.
BISEC
Nemanja Zdravkovic, Dragan Domazet, Sonsoles López-Pernas, Miguel Ángel Conde, Ponnusamy Vijayakumar
2023 conf
BISEC
Stefan Gogic, Nemanja Zdravkovic, Emilija Kisic, Ponnusamy Vijayakumar
2023 conf
eLearning
Emilija Kisic, Miroslava Raspopovic Milic, Nemanja Zdravkovic, Miguel Ángel Conde
2022 conf
BISEC
Sara Nikolic, Nemanja Zdravkovic, Igor Franc, N. Arivazhagan
2022 conf
eLearning
Nemanja Zdravkovic, Nikola Dimitrijevic, Dusan J. Simjanovic, Vijayakumar Ponnusamy
2022 conf
eLearning
Emilija Kisic, Miroslava Raspopovic Milic, Nemanja Zdravkovic, Vladimir Milicevic
2022 J jnl
Axioms
Dusan J. Simjanovic, Nemanja Zdravkovic, Nenad O. Vesic
2017
Nemanja Zdravkovic
2016 J jnl
EURASIP J. Wirel. Commun. Netw.
Nemanja Zdravkovic, Aleksandra M. Cvetkovic, Kimmo Kansanen, Goran T. Djordjevic
2015 J jnl
J. Frankl. Inst.
Jelena A. Anastasov, Nemanja Zdravkovic, Goran T. Djordjevic
redb/logging_utils.py
← Index redb/logging_utils.py python
"""
Logging utilities and shared enums for REDB.

Contains the ImportResult enum, log formatters, and logger setup functions
used across the ingestor pipeline.
"""
import logging
from logging.handlers import QueueHandler
import os
from enum import Enum


class ImportResult(Enum):
    CORRECTLY = 0
    PARTIALLY = 1
    FAILED = 2
    PENDING = 3
    SKIPPED = 4


class FileNameFormatter(logging.Formatter):
    def format(self, record):
        record.filenameinfo = getattr(record, "filenameinfo", "unknown")
        return super().format(record)


def setup_logger(log_queue, filename):
    logger = logging.getLogger(filename)
    if not logger.handlers:
        if os.getenv("SERVER_ENV") == "prod":
            logger.setLevel(logging.INFO)
        else:
            logger.setLevel(logging.DEBUG)
        handler = QueueHandler(log_queue)
        logger.addHandler(handler)
        logger.propagate = False  # Prevent propagation to parent loggers
    return logger


def logger_thread(log_queue, log_file):
    handler = logging.FileHandler(log_file)
    formatter = FileNameFormatter(
        "%(asctime)s - %(filenameinfo)s - %(levelname)s - %(message)s"
    )
    handler.setFormatter(formatter)

    while True:
        try:
            record = log_queue.get()
            if record is None:
                break
            # Format and write the log record
            message = formatter.format(record)
            handler.stream.write(message + "\n")
            handler.stream.flush()
        except Exception:
            import traceback
            import sys

            print("[ERR] Error in logger thread:", file=sys.stderr)
            traceback.print_exc(file=sys.stderr)


def setup_direct_logger(log_file, filename, pid=None):
    """Setup a logger that writes directly to the log file without using a queue."""
    # Create a unique logger name using the process ID
    logger_name = f"{filename}_{pid}" if pid else filename
    logger = logging.getLogger(logger_name)

    if not logger.handlers:
        handler = logging.FileHandler(log_file)
        formatter = logging.Formatter("%(asctime)s - %(filenameinfo)s - %(levelname)s - %(message)s")
        handler.setFormatter(formatter)
        logger.addHandler(handler)

        if os.getenv("SERVER_ENV") == "prod":
            logger.setLevel(logging.INFO)
        else:
            logger.setLevel(logging.DEBUG)

    # Add filename info to the logger's extra info
    extra = {"filenameinfo": filename}
    logger = logging.LoggerAdapter(logger, extra)

    return logger