Color output & logging.
339323
def printif(self, obj_print, tipo_print=None):
        """"""
        if self.verbose:
            print(obj_print)
        if tipo_print == 'ok':
            logging.info(obj_print)
        elif tipo_print == 'error':
            logging.error(obj_print)
        elif tipo_print == 'warning':
            logging.warning(obj_print)
939055
function writeToLog(chunk, encoding, colorFunction) {
        // We stopped logging in a previous call to write: return now
        if (_logBytesWritten > LOG_SIZE_LIMIT) { return; }

        var chunkLength,
            logMsg;

        if (!Buffer.isBuffer(chunk)) {
            chunk = String(chunk);
            if (colorFunction) {
                chunk = colorFunction(chunk);
            }
            chunkLength = Buffer.byteLength(chunk, encoding);
        } else {
            chunkLength = chunk.length;
        }

        // Calculate the new log file size
        _logBytesWritten += chunkLength;

        // Limit not yet reached: write to log file
        if (_logBytesWritten > LOG_SIZE_LIMIT) {
            logMsg = "The log file size limit of " + LOG_SIZE_LIMIT + " bytes was reached." +
                " No further output will be written to this file.";
        } else {
            logMsg = chunk;
        }

        _logFilePaths.forEach(function (path) {
            try {
                fs.appendFileSync(path, logMsg, { encoding: encoding });
            } catch (e) {
                // do nothing
            }
        });
    }
611885
def clog(color):
    """"""
    logger = log(color)
    return lambda msg: logger(centralize(msg).rstrip())
359421
def display(level='DEBUG'):
    """"""
    logger = get_logger()
    sh = logging.StreamHandler()
    sh.setLevel(getattr(logging, level))
    sh.setFormatter(DEFAULT_LOG_FORMAT)
    logger.addHandler(sh)
481987
def OnBGColor(self, event):
        """"""

        color = event.GetValue().GetRGB()

        post_command_event(self, self.BackgroundColorMsg, color=color)
658049
def colorlog(msg, color, bold=False, blink=False):
    """"""

    # ANSI Escape Codes
    PINK_COL = '\x1b[35m'
    GREEN_COL = '\x1b[32m'
    RED_COL = '\x1b[31m'
    YELLOW_COL = '\x1b[33m'
    BLINK = '\x1b[5m'
    RESET = '\x1b[0m'

    if platform.system() != 'Windows':
        if blink:
            msg = BLINK + msg + RESET
        if color == 'yellow':
            msg = YELLOW_COL + msg + RESET
        if color == 'red':
            msg = RED_COL + msg + RESET
        if color == 'green':
            msg = GREEN_COL + msg + RESET
        if color == 'pink':
            msg = PINK_COL + msg + RESET
    return msg
939004
def display(self, ret, indent, prefix, out):
        '''
        
        '''
        if isinstance(ret, six.string_types):
            lines = ret.split('\n')
            for line in lines:
                out += '{0}{1}{2}{3}{4}\n'.format(
                        self.colors['RED'],
                        ' ' * indent,
                        prefix,
                        line,
                        self.colors['ENDC'])
        elif isinstance(ret, dict):
            for key in sorted(ret):
                val = ret[key]
                out += '{0}{1}{2}{3}{4}:\n'.format(
                        self.colors['CYAN'],
                        ' ' * indent,
                        prefix,
                        key,
                        self.colors['ENDC'])
                out = self.display(val, indent + 4, '', out)
        return out
693658
def setup_logging(log_level=logging.INFO):
    """"""
    logging.basicConfig(level=log_level)
    fmt = ("%(asctime)s %(levelname)s (%(threadName)s) "
           "[%(name)s] %(message)s")
    colorfmt = "%(log_color)s{}%(reset)s".format(fmt)
    datefmt = '%Y-%m-%d %H:%M:%S'

    # Suppress overly verbose logs from libraries that aren't helpful
    logging.getLogger('requests').setLevel(logging.WARNING)

    try:
        from colorlog import ColoredFormatter
        logging.getLogger().handlers[0].setFormatter(ColoredFormatter(
            colorfmt,
            datefmt=datefmt,
            reset=True,
            log_colors={
                'DEBUG': 'cyan',
                'INFO': 'green',
                'WARNING': 'yellow',
                'ERROR': 'red',
                'CRITICAL': 'red',
            }
        ))
    except ImportError:
        pass

    logger = logging.getLogger('')
    logger.setLevel(log_level)
36573
def display_status():
    """"""
    def print_status(msg, color):
        """Print the status message.

        Args:
            msg: The message to display (e.g. OK or FAILED).
            color: The ANSI color code to use in displaying the message.
        """
        print('\r' if sys.stdout.isatty() else '\t', end='')
        print('{}{}[{color}{msg}{}]{}'.format(
            Cursor.FORWARD(_ncols() - 8),
            Style.BRIGHT,
            Fore.RESET,
            Style.RESET_ALL,
            color=color,
            msg=msg[:6].upper().center(6)
        ))
        sys.stdout.flush()

    try:
        yield
    except Status as e:
        _LOGGER.debug(e)
        print_status(e.msg, e.color)
        if e.exc:
            raise e.exc  # pylint: disable=raising-bad-type
    except (KeyboardInterrupt, EOFError):
        raise
    except Exception:
        print_status('FAILED', Fore.RED)
        raise
    else:
        print_status('OK', Fore.GREEN)
134495
def color_prompt(self):
        '''  '''
        prompt = '[' + colorize('psiTurk', 'bold')
        server_string = ''
        server_status = self.server.is_server_running()
        if server_status == 'yes':
            server_string = colorize('on', 'green')
        elif server_status == 'no':
            server_string = colorize('off', 'red')
        elif server_status == 'maybe':
            server_string = colorize('unknown', 'yellow')
        elif server_status == 'blocked':
            server_string = colorize('blocked', 'red')
        prompt += ' server:' + server_string
        prompt += ' mode:' + colorize('cabin', 'bold')
        prompt += ']$ '
        self.prompt = prompt
1292460
def init_fileoutput (self, args):
        """"""
        super(TextLogger, self).init_fileoutput(args)
        if self.fd is not None:
            self.fd = ansicolor.Colorizer(self.fd)
1059336
public static <T extends ImageBase<T>> void log(T input , T output ) {
		if( input instanceof ImageGray ) {
			if (GrayF32.class == input.getClass()) {
				PixelMath.log((GrayF32) input, (GrayF32) output);
			} else if (GrayF64.class == input.getClass()) {
				PixelMath.log((GrayF64) input, (GrayF64) output);
			} else {
				throw new IllegalArgumentException("Unknown image Type: " + input.getClass().getSimpleName());
			}
		} else if( input instanceof Planar ) {
			Planar in = (Planar)input;
			Planar out = (Planar)output;

			for (int i = 0; i < in.getNumBands(); i++) {
				log( in.getBand(i), out.getBand(i));
			}
		}
	}
270781
function () {
        var prefix = 'DEBUG';
        this.output(prefix, prefix.blue, Array.prototype.slice.call(arguments));
    }
863366
def _color(self, color, msg):
        
        if self.useColor:
            return '{0}{1}{2}'.format(color, msg, self.RESET_SEQ)
        else:
            return msg
1023990
function log(color, args) {
  if (!globalOptions.verbose) {
    return;
  }

  args = Array.prototype.slice.call(args);
  args.unshift(color);
  args.push(COLOR_RESET);

  console.log.apply(console, args); // eslint-disable-line
}
819548
def log(self, *lines):
        """"""
        if getattr(self, "debug", False):
            print(dt.datetime.now().time(), end=' ')
            for line in lines:
                print(line, end=' ')
            print()
1140350
def start_fileoutput (self):
        """"""
        init_color = self.fd is None
        super(TextLogger, self).start_fileoutput()
        if init_color:
            self.fd = ansicolor.Colorizer(self.fd)