cars.core.cars_logging

cCars logging module: contains cars logging setup logger for main thread and workers

Attributes

SYS_PLATFORM

IS_WIN

PROGRESS

PROFILING_LOG

profiling_logger

_WARNING_COUNTER

_WARNING_LOCK

Classes

WarningCounterHandler

In-process warning counter handler.

ProfilingFilter

ProfilingFilter

ProfilinglHandler

Profiling

WorkerHandler

Profiling

LogSender

LogSender

Functions

lock(file)

Lock file for safe writing (Windows version)

reset_warning_count(→ None)

Reset global warning counting state for a fresh pipeline run.

get_warning_count(→ int)

Get total warning count captured by WarningCounterHandler.

setup_logging([loglevel, out_dir, log_dir, pipeline, ...])

Setup the CARS logging configuration

add_progress_message(message)

Add enforced message with INFO level

add_profiling_message(message)

Add enforced message with PROFILING_LOG level

wrap_logger(func, log_dir, log_level)

Wrapper logger function to wrap worker func

logger_func(*args, **kwargs)

Logger function to wrap worker func (with non local method)

Module Contents

cars.core.cars_logging.SYS_PLATFORM
cars.core.cars_logging.IS_WIN
cars.core.cars_logging.lock(file)[source]

Lock file for safe writing (Windows version)

cars.core.cars_logging.PROGRESS = 21
cars.core.cars_logging.PROFILING_LOG = 15
cars.core.cars_logging.profiling_logger
cars.core.cars_logging._WARNING_COUNTER = 0
cars.core.cars_logging._WARNING_LOCK
cars.core.cars_logging.reset_warning_count() None[source]

Reset global warning counting state for a fresh pipeline run.

cars.core.cars_logging.get_warning_count() int[source]

Get total warning count captured by WarningCounterHandler.

class cars.core.cars_logging.WarningCounterHandler(level=NOTSET)[source]

Bases: logging.Handler

In-process warning counter handler.

emit(record)[source]

Do whatever it takes to actually log the specified logging record.

This version is intended to be implemented by subclasses and so raises a NotImplementedError.

class cars.core.cars_logging.ProfilingFilter(name='')[source]

Bases: logging.Filter

ProfilingFilter

filter(record)[source]

Filter message

class cars.core.cars_logging.ProfilinglHandler(filename, mode='a', encoding=None, delay=False)[source]

Bases: logging.FileHandler

Profiling

sender
emit(record)[source]

Emit

class cars.core.cars_logging.WorkerHandler(filename, mode='a', encoding=None, delay=False)[source]

Bases: logging.FileHandler

Profiling

sender
emit(record)[source]

Emit

class cars.core.cars_logging.LogSender(log_file)[source]

LogSender

log_file
write_log(msg) None[source]

Write log

cars.core.cars_logging.setup_logging(loglevel='PROGRESS', out_dir=None, log_dir=None, pipeline='', in_worker=False, global_log_file=None, use_stdout=True)[source]

Setup the CARS logging configuration

Parameters:
  • loglevel – log level default WARNING

  • use_stdout – whether to add stdout handler (default: True)

cars.core.cars_logging.add_progress_message(message)[source]

Add enforced message with INFO level to stdout and logging file

Parameters:

message – logging message

cars.core.cars_logging.add_profiling_message(message)[source]

Add enforced message with PROFILING_LOG level to stdout and logging file

Parameters:

message – logging message

cars.core.cars_logging.wrap_logger(func, log_dir, log_level)[source]

Wrapper logger function to wrap worker func and setup the worker logger :param func: wrapped function :param log_dir: output directory of worker logs :param log_level: logging level of the worker logs

cars.core.cars_logging.logger_func(*args, **kwargs)[source]

Logger function to wrap worker func (with non local method) and setup the worker logger

Parameters:
  • argv – args of func

  • kwargs – kwargs of func