Manoel Lemos

49 papers Journal 49
YearRankTypeTitle / Venue / Authors
2023 J jnl
Electron. J. Comb.
Manoel Lemos, James G. Oxley
2023 J jnl
Discret. Math.
Manoel Lemos
2022 J jnl
Discret. Math.
Manoel Lemos
2020 J jnl
Discret. Math.
Manoel Lemos
2018 J jnl
Eur. J. Comb.
Manoel Lemos
2016 J jnl
Discret. Math.
Antonio José Ferreira Gomes Jr., Manoel Lemos
2015 J jnl
Eur. J. Comb.
Manoel Lemos, Maria Isabelle Silva
2014 J jnl
Graphs Comb.
Sandra R. Kingan, Manoel Lemos
2013 J jnl
Adv. Appl. Math.
Manoel Lemos
2012 J jnl
Eur. J. Comb.
Sandra R. Kingan, Manoel Lemos
2012 J jnl
Discret. Math.
Manoel Lemos
2011 J jnl
Eur. J. Comb.
Hong-Jian Lai, Manoel Lemos, Talmage James Reid, Yehong Shao, Haidong Wu
2011 J jnl
Eur. J. Comb.
Manoel Lemos, Talmage James Reid, Haidong Wu
2010 J jnl
J. Graph Theory
Manoel Lemos, Talmage James Reid, Haidong Wu
2010 J jnl
Discret. Math.
Raul Cordovil, Manoel Lemos
2009 J jnl
Adv. Appl. Math.
Manoel Lemos
2009 J jnl
Discret. Math.
Raul Cordovil, Braulio Maia Jr., Manoel Lemos
2009 J jnl
Eur. J. Comb.
Raul Cordovil, Braulio Maia Jr., Manoel Lemos
2008 J jnl
Discret. Appl. Math.
Manoel Lemos, T. R. B. Melo
2008 J jnl
Graphs Comb.
Manoel Lemos
2007 J jnl
Eur. J. Comb.
Manoel Lemos
2006 J jnl
Discret. Math.
Manoel Lemos
2006 J jnl
J. Comb. Theory B
Manoel Lemos, James G. Oxley
2006 J jnl
Discret. Math.
Manoel Lemos
2006 J jnl
Graphs Comb.
Sandra R. Kingan, Manoel Lemos
2006 J jnl
Graphs Comb.
Manoel Lemos
2005 J jnl
Electron. Notes Discret. Math.
Manoel Lemos, T. R. B. Melo
2004 J jnl
Discret. Math.
Manoel Lemos
2004 J jnl
Discret. Math.
Manoel Lemos, James G. Oxley
2004 J jnl
Adv. Appl. Math.
Manoel Lemos
2003 J jnl
Discret. Math.
Manoel Lemos
2003 J jnl
J. Graph Theory
Manoel Lemos, James G. Oxley
2003 J jnl
Eur. J. Comb.
Manoel Lemos, James G. Oxley
2003 J jnl
Discret. Math.
Manoel Lemos
2002 J jnl
Adv. Appl. Math.
Sandra R. Kingan, Manoel Lemos
2002 J jnl
J. Comb. Theory B
Manoel Lemos
2001 J jnl
Comb. Probab. Comput.
Braulio Maia Jr., Manoel Lemos
2001 J jnl
Discret. Math.
Manoel Lemos
2000 J jnl
Discret. Math.
Manoel Lemos, James G. Oxley
2000 J jnl
Graphs Comb.
Manoel Lemos, James G. Oxley, Talmage James Reid
2000 J jnl
Discret. Math.
Manoel Lemos, James G. Oxley
2000 J jnl
Discret. Math.
Manoel Lemos, Sérgio Mota
1999 J jnl
J. Graph Theory
Manoel Lemos, James G. Oxley
1998 J jnl
Discret. Math.
Manoel Lemos, James G. Oxley
1997 J jnl
Ars Comb.
Manoel Lemos
1994 J jnl
Discret. Math.
Manoel Lemos
1994 J jnl
Comb. Probab. Comput.
Manoel Lemos
1989 J jnl
Discret. Math.
Manoel Lemos
1988 J jnl
Discret. Math.
Manoel Lemos
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