Map log levels to strings
345318
def _get_py_loglevel(lvl):
    
    if not lvl:
        lvl = 'INFO'

    return LOG_LEVEL_MAP.get(lvl.upper(), logging.DEBUG)
593063
def log_env(self, level, env):
        """"""
        self.log(level, "ENVIRONMENT:")
        for k, v in env.items():
            self.log(level, "    {} = {}".format(k, pformat(v)))
566979
def set_log_level(self, level: str) -> None:
        """"""
        if level == 'info':
            to_set = logging.INFO
        if level == 'debug':
            to_set = logging.DEBUG
        if level == 'error':
            to_set = logging.ERROR
        self.log.setLevel(to_set)
180735
function log(level, message, stackLevel) {
  //	util.log("log: " + level + " : " + message);		
  var index = log_types.indexOf(level);
  if (index <= log_level) {
//    console.log( typeof message)
    if (typeof message !== 'string') {
      if( message instanceof Error) {
        message = message.toString();
      } else {
        message = JSON.stringify(message);
      }
    }

    if (index == 1) message = "*** " + message;

    if (__stack) {
      var ref = __stack[2];
      var line = ref.getLineNumber();
      var name = ref.getFileName().replace(process.cwd() + '/', '');
      message = "(" + name + ":" + line + "): " + message;

    }

    util.log(log_labels[index] + ' ' + message);
  }
}
523157
function logLevelLabel(logLevel) {
    switch (logLevel) {
        case exports.LOG_EMERGENCY: return 'emergency';
        case exports.LOG_ALERT: return 'alert';
        case exports.LOG_CRITICAL: return 'critical';
        case exports.LOG_ERROR: return 'error';
        case exports.LOG_WARNING: return 'warning';
        case exports.LOG_NOTICE: return 'notice';
        case exports.LOG_INFORMATIONAL: return 'info';
        case exports.LOG_DEBUG: return 'debug';
        default: return '';
    }
}
357044
def format_entry(record, show_level=False, colorize=False):
    
    if show_level:
        log_str = u'{}: {}'.format(record.levelname, record.getMessage())
    else:
        log_str = record.getMessage()

    if colorize and record.levelname in LOG_COLORS:
        log_str = u'<span color="{}">'.format(LOG_COLORS[record.levelname]) + log_str + u'</span>'

    return log_str
458689
def parse_log(log, url_pattern):
    
    hits = {}
    initial_timestamp = None

    def clean_timestamp(v):
        return ' '.join(v).strip('[]')
    for line in log:
        data = line.split()
        if not initial_timestamp:
            initial_timestamp = clean_timestamp(data[3:5])
        match = url_pattern.match(data[6])
        if match:
            ident_hash = '@'.join(match.groups())
            if ident_hash:
                hits[ident_hash] = hits.get(ident_hash, 0) + 1
    else:
        end_timestamp = clean_timestamp(data[3:5])
    return hits, initial_timestamp, end_timestamp
608188
function (logLevel, args) {
            const time = dateFormat(new Date(), 'dd/mm/yyyy, h:MM:ss.l tt');
            // Each logger can have its own name. If this is
            // not provided, it will default to Unknown.
            const loggerName = __private.name || Constants.LOG_UNKNOWN_APP_ID;
            return [ (logLevel.name.length === 4 ? ' ' : '') +
                getLogLabel(logLevel)('[' + logLevel.name + ']'), time, '-',
            loggerName.padEnd(Constants.LOG_APP_ID_WIDTH), ':'].concat(Object.values(args));
        }
1309529
def getLogLevelNo(level):
    """"""
    if isinstance(level,(int,long)):
        return level
    try:
        return(int(logging.getLevelName(level.upper())))
    except:
        raise ValueError('illegal loglevel %s' % level)
242390
function logWrap(level) {
    return function log() {
      let context, message, args, trace, err;

      if (arguments[0] instanceof Error) {
        // log.<level>(err, ...)
        context = API.getContext();
        args = Array.prototype.slice.call(arguments, 1);
        if (!args.length) {
          // log.<level>(err)
          err = arguments[0];
          message = err.name + ': ' + err.message;
        } else {
          // log.<level>(err, "More %s", "things")
          // Use the err as context information
          err = arguments[0];
          message = arguments[1];
          args = Array.prototype.slice.call(args, 1);
        }
      } else if (arguments[0] == null || (typeof (arguments[0]) !== 'object' && arguments[0] !== null) ||
          Array.isArray(arguments[0])) {
        // log.<level>(msg, ...)
        context = API.getContext();
        message = arguments[0];
        args = Array.prototype.slice.call(arguments, 1);
      } else {
        // log.<level>(fields, msg, ...)
        context = merge(API.getContext(), arguments[0]);
        message = arguments[1];
        args = Array.prototype.slice.call(arguments, 2);
      }

      trace = API.format(level, context || {}, message, args, err);
      API.stream.write(trace + '\n');
    };
  }
85708
def log_level(self, level):
        
        if 0 <= level <= 7:
            for i in range(level+1):
                self.add_match(PRIORITY="%d" % i)
        else:
            raise ValueError("Log level must be 0 <= level <= 7")
95399
function logstashLayout(logEvt, fields) {
    var messageData = logEvt.data[0], 
        log = {
            '@timestamp': (new Date()).toISOString(),
            '@fields': {
                category: logEvt.categoryName,
                level: logEvt.level.levelStr
            },
            '@message' : (toType(messageData) === "string") ? messageData : JSON.stringify(messageData)
        }
    
    for (var key in fields) {
        if (typeof fields[key] !== 'function') {
            log['@fields'][key] = fields[key];
        }
    }

    return JSON.stringify(log) + '\n';
}
1251472
function(nameOrNum) {
    if(nameOrNum === undefined) {
      return currentLogLevel;
    }

    if(typeof(nameOrNum) === 'string') {
      nameOrNum = levelFromName[nameOrNum.toLowerCase()];
    }

    if(nameOrNum === undefined ||
       !(TRACE <= nameOrNum && nameOrNum <= DISABLED)) {
      throw new Error('invalid log level: ' + nameOrNum);
    }

    currentLogLevel = nameOrNum;
  }
254355
function logWithArgs(level, args) {
    args = [level].concat([].slice.call(args));
    logger.logLevel.apply(logger, args);
}
1268289
def get_logs(self, log_stream_name, get_last=50):
        """"""
        response = self._log_client.get_log_events(
            logGroupName='/aws/batch/job',
            logStreamName=log_stream_name,
            startFromHead=False)
        events = response['events']
        return '\n'.join(e['message'] for e in events[-get_last:])
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)
1017326
public static LogLevel toLogLevel(Object value) {
		if (value == null)
			return LogLevel.Info;

		value = value.toString().toUpperCase();
		if ("0".equals(value) || "NOTHING".equals(value) || "NONE".equals(value))
			return LogLevel.None;
		else if ("1".equals(value) || "FATAL".equals(value))
			return LogLevel.Fatal;
		else if ("2".equals(value) || "ERROR".equals(value))
			return LogLevel.Error;
		else if ("3".equals(value) || "WARN".equals(value) || "WARNING".equals(value))
			return LogLevel.Warn;
		else if ("4".equals(value) || "INFO".equals(value))
			return LogLevel.Info;
		else if ("5".equals(value) || "DEBUG".equals(value))
			return LogLevel.Debug;
		else if ("6".equals(value) || "TRACE".equals(value))
			return LogLevel.Trace;
		else
			return LogLevel.Info;
	}