easybuild.tools.build_log module

EasyBuild logger and log utilities, including our own EasybuildError class.

author:Stijn De Weirdt (Ghent University)
author:Dries Verdegem (Ghent University)
author:Kenneth Hoste (Ghent University)
author:Pieter De Baets (Ghent University)
author:Jens Timmerman (Ghent University)
exception easybuild.tools.build_log.EasyBuildError(msg, *args)

Bases: vsc.utils.exceptions.LoggedException

EasyBuildError is thrown when EasyBuild runs into something horribly wrong.

INCLUDE_LOCATION = True
LOC_INFO_LEVEL = 1
LOC_INFO_TOP_PKG_NAMES = ['easybuild', 'vsc']
class easybuild.tools.build_log.EasyBuildLog(name, level=0)

Bases: vsc.utils.fancylogger.FancyLogger

The EasyBuild logger, with its own error and exception functions.

RAISE_EXCEPTION_CLASS

alias of EasyBuildError

caller_info()

Return string with caller info.

deprecated(msg, ver, max_ver=None, *args, **kwargs)

Print deprecation warning or raise an exception, depending on specified version(s)

Param:

msg: deprecation message

Parameters:
  • ver – if max_ver is None: threshold for EasyBuild version to determine warning vs exception else: version to check against max_ver to determine warning vs exception
  • max_ver – version threshold for warning vs exception (compared to ‘ver’)
devel(msg, *args, **kwargs)

Print development log message

error(msg, *args, **kwargs)

Print error message and raise an EasyBuildError.

exception(msg, *args)

Print exception message and raise EasyBuildError.

experimental(msg, *args, **kwargs)

Handle experimental functionality if EXPERIMENTAL is True, otherwise log error

nosupport(msg, ver)

Print error message for no longer supported behaviour, and raise an EasyBuildError.

easybuild.tools.build_log.dry_run_msg(msg, silent=False)

Print dry run message.

easybuild.tools.build_log.dry_run_set_dirs(prefix, builddir, software_installdir, module_installdir)

Initialize for printing dry run messages.

Define DRY_RUN_*DIR constants, so they can be used in dry_run_msg to replace fake build/install dirs.

Parameters:
  • prefix – prefix of fake build/install dirs, that can be stripped off when printing
  • builddir – fake build dir
  • software_installdir – fake software install directory
  • module_installdir – fake module install directory
easybuild.tools.build_log.dry_run_warning(msg, silent=False)

Print dry run message.

easybuild.tools.build_log.get_log(name=None)

(NO LONGER SUPPORTED!) Generate logger object

easybuild.tools.build_log.init_logging(logfile, logtostdout=False, silent=False, colorize='auto')

Initialize logging.

easybuild.tools.build_log.print_error(message, log=None, exitCode=1, opt_parser=None, exit_on_error=True, silent=False)

Print error message and exit EasyBuild

easybuild.tools.build_log.print_msg(msg, log=None, silent=False, prefix=True, newline=True, stderr=False)

Print a message.

Parameters:
  • log – logger instance to also message to
  • silent – be silent (only log, don’t print)
  • prefix – include message prefix characters (‘== ‘)
  • newline – end message with newline
  • stderr – print to stderr rather than stdout
easybuild.tools.build_log.print_warning(message, silent=False)

Print warning message.

easybuild.tools.build_log.raise_easybuilderror(msg, *args)

Raise EasyBuildError with given message, formatted by provided string arguments.

easybuild.tools.build_log.stop_logging(logfile, logtostdout=False)

Stop logging.

easybuild.tools.build_log.time_str_since(start_time)

Return string representing amount of time that has passed since specified timestamp

Parameters:start_time – datetime value representing start time
Returns:string value representing amount of time passed since start_time; format: “[[%d hours, ]%d mins, ]%d sec(s)”