Idahosa A. Osaretin

12 papers C 7Journal 5
YearRankTypeTitle / Venue / Authors
2022 J jnl
IEEE Trans. Geosci. Remote. Sens.
Edward Kim, Saji Abraham, Joel Amato, William J. Blackwell, Peter Cho, James Fuentes, Mark Hernquist, James Kam, Robert Vincent Leslie, Quanhua (Mark) Liu, Cheng-Hsuan Lyu, Taichien Mao, Idahosa A. Osaretin, Fabian Rodriguez-Gutierrez, Matthew Sammons, Craig K. Smith, Ninghai Sun, Hu Yang
2021 J jnl
IEEE Trans. Geosci. Remote. Sens.
Angela Crews, William J. Blackwell, Robert Vincent Leslie, Michael S. Grant, Idahosa A. Osaretin, Michael DiLiberto, Adam B. Milstein, Stephen S. Leroy, Amelia Gagnon, Kerri L. Cahoy
2021 J jnl
IEEE Trans. Geosci. Remote. Sens.
Cheng-Hsuan Lyu, Edward J. Kim, Lisa McCormick, Robert Vincent Leslie, Idahosa A. Osaretin
2020 C conf
IGARSS
Robert Vincent Leslie, William J. Blackwell, Andrew Cunningham, Michael DiLiberto, James Eshbaugh, Idahosa A. Osaretin
2020 C conf
IGARSS
Edward Kim, Robert Vincent Leslie, C.-H. Joseph Lyu, Craig K. Smith, Idahosa A. Osaretin, Saji Abraham, Matt Sammons, Kent Anderson, Joel Amato, James Fuentes, Mark Hernquist, Mike Landrum, Fabian Rodriguez-Gutierrez, James Kam, Peter Cho, Hu Yang, Quanhua (Mark) Liu, Ninghai Sun
2018 C conf
IGARSS
Edward Kim, Vince Leslie, C.-H. Joseph Lyu, Lisa McCormick, Craig K. Smith, Idahosa A. Osaretin, Quanhua (Mark) Liu, Ninghai Sun, Hu Yang, Lin Lin, Kent Anderson, Mark Hernquist, James Fuentes, Elliot Stiglic, Michael Replan
2016 J jnl
IEEE J. Sel. Top. Appl. Earth Obs. Remote. Sens.
Anne D. Marinan, Kerri L. Cahoy, Rebecca L. Bishop, Susan Seto Lui, James R. Bardeen, Tamitha Mulligan, William J. Blackwell, Robert Vincent Leslie, Idahosa A. Osaretin, Michael Shields
2014 J jnl
IEEE Trans. Geosci. Remote. Sens.
William J. Blackwell, Rebecca L. Bishop, Kerri L. Cahoy, Brian Cohen, Clayton Crail, Lidia Cucurull, Pratik K. Dave, Michael DiLiberto, Neal Erickson, Chad Fish, Shu-peng Ho, Robert Vincent Leslie, Adam B. Milstein, Idahosa A. Osaretin
2013 C conf
IGARSS
William J. Blackwell, Michael DiLiberto, Robert Vincent Leslie, Adam B. Milstein, Idahosa A. Osaretin, B. S. Cohen, Pratik K. Dave, Kerri L. Cahoy
2013 C conf
IGARSS
William J. Blackwell, G. Allen, Christopher J. Galbraith, Robert Vincent Leslie, Idahosa A. Osaretin, B. Reid, Michael Scarito, Michael Shields, E. Thompson, D. Toher, D. Townzen, Kerri L. Cahoy, David W. Miller
2012 C conf
IGARSS
William J. Blackwell, Christopher J. Galbraith, Timothy M. Hancock, Robert Vincent Leslie, Idahosa A. Osaretin, Michael Shields, Paul Racette, Lawrence Hilliard
2012 C conf
IGARSS
William J. Blackwell, G. Allen, Christopher J. Galbraith, Timothy M. Hancock, Robert Vincent Leslie, Idahosa A. Osaretin, L. Retherford, Michael Scarito, C. Semisch, Michael Shields, M. Silver, D. Toher, K. Wight, David W. Miller, Kerri L. Cahoy, Neal Erickson
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