Converts a string to the corresponding log level
1114
def string_to_level(log_level):
  
  if (log_level.strip().upper() == "DEBUG"):
    return logging.DEBUG
  if (log_level.strip().upper() == "INFO"):
    return logging.INFO
  if (log_level.strip().upper() == "WARNING"):
    return logging.WARNING
  if (log_level.strip().upper() == "ERROR"):
    return logging.ERROR
607941
public Level tango_to_log4j_level(String level)
  {
   level = level.toUpperCase();
   if (level.equals(LOGGING_LEVELS[LOGGING_OFF])) {
     return Level.OFF;
   }
   if (level.equals(LOGGING_LEVELS[LOGGING_FATAL])) {
     return Level.FATAL;
   }
   if (level.equals(LOGGING_LEVELS[LOGGING_ERROR])) {
     return Level.ERROR;
   }
   if (level.equals(LOGGING_LEVELS[LOGGING_INFO])) {
     return Level.INFO;
   }
   if (level.equals(LOGGING_LEVELS[LOGGING_DEBUG])) {
     return Level.DEBUG;
   }
   return Level.WARN;
  }
538093
static public String fromLevel(int level, int length) {
        StringBuffer sb = new StringBuffer(length > 7 ? length : 7);
        switch (level) {
        case LogService.LOG_INFO:
            sb.append("info");
            break;
        case LogService.LOG_DEBUG:
            sb.append("debug");
            break;
        case LogService.LOG_WARNING:
            sb.append("Warning");
            break;
        case LogService.LOG_ERROR:
            sb.append("ERROR");
            break;
        case 0:
            sb.append("DEFAULT");
            break;
        default:
            sb.append("[");
            sb.append(level);
            sb.append("]");
        }
        for (int i = sb.length(); i < length; i++) {
            sb.append(" ");
        }
        return sb.toString();
    }
399973
def init_logging(log_level):
    
    log_level = log_level_to_string_map[min(log_level, 5)]

    msg = "%(levelname)s - %(name)s:%(lineno)s - %(message)s" if log_level in os.environ else "%(levelname)s - %(message)s"

    logging_conf = {
        "version": 1,
        "root": {
            "level": log_level,
            "handlers": ["console"]
        },
        "handlers": {
            "console": {
                "class": "logging.StreamHandler",
                "level": log_level,
                "formatter": "simple",
                "stream": "ext://sys.stdout"
            }
        },
        "formatters": {
            "simple": {
                "format": " {0}".format(msg)
            }
        }
    }

    logging.config.dictConfig(logging_conf)
1043674
public String getLoggerLevel(String loggerName) throws Exception {
        Address addr = Address.root().add(SUBSYSTEM, LOGGING, LOGGER, loggerName);
        return getStringAttribute("level", addr);
    }
1266882
def level_to_index(level)
      return if level.nil?

      case level
      when Symbol
        LEVELS.index(level)
      when String
        LEVELS.index(level.downcase.to_sym)
      when Integer
        map_levels[level] || fail_with_unkown_log_level!(level)
      else
        fail_with_unkown_log_level!(level)
      end
    end
457720
private void log(Level level, String content, Throwable throwable) {
        String dateStr = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date());
        String log = String.format("[%s] %s [] - %s", level, dateStr, content);
        if(level.isLessSpecificThan(Level.ERROR)
                && level.isMoreSpecificThan(Level.OFF)) {
            System.err.println(log);
        } else {
            System.out.println(log);
        }

        if (throwable != null) {
            throwable.printStackTrace(System.err);
        }
    }
419676
function getLogLevel(level, action, payload, type) {
  switch (typeof level === 'undefined' ? 'undefined' : _typeof(level)) {
    case 'object':
      return typeof level[type] === 'function' ? level[type].apply(level, _toConsumableArray(payload)) : level[type];
    case 'function':
      return level(action);
    default:
      return level;
  }
}
765850
function coeffToString(a) {
        var s, z,
            i = 1,
            j = a.length,
            r = a[0] + '';

        for ( ; i < j; ) {
            s = a[i++] + '';
            z = LOG_BASE - s.length;
            for ( ; z--; s = '0' + s );
            r += s;
        }

        // Determine trailing zeros.
        for ( j = r.length; r.charCodeAt(--j) === 48; );
        return r.slice( 0, j + 1 || 1 );
    }
869942
def set_log_level(self, log_level):
        '''

        '''
        if log_level == 'DEBUG':
            self.log.setLevel(logging.DEBUG)
            self.log.debug("Changing log level to "+log_level)
        elif log_level == 'INFO':
            self.log.setLevel(logging.INFO)
            self.log.info("Changing log level to "+log_level)
        elif log_level == 'WARNING':
            self.log.setLevel(logging.WARNING)
            self.log.warning("Changing log level to "+log_level)
        elif log_level == 'ERROR':
            self.log.setLevel(logging.ERROR)
            self.log.error("Changing log level to "+log_level)
        elif log_level == 'CRITICAL':
            self.log.setLevel(logging.CRITICAL)
            self.log.critical("Changing log level to "+log_level)
        elif log_level == 'NOTSET':
            self.log.setLevel(logging.NOTSET)
        else:
            raise NotImplementedError('Not implemented log level '+str(log_level))
993335
def _print_level(level, msg):
    """"""
    for l in str(msg.rstrip()).split("\n"):
        print("{0:<9s}{1}".format(level, str(l)))
211881
private static String getTabBasedOnLevel(int level, int indentSize) {
        StringBuilder sb = new StringBuilder();
        for(int i = 0; i < level; i ++) {
            for(int j = 0; j < indentSize; j++) {
                sb.append(" ");
            }
        }
        return sb.toString();
    }
187398
def restore_logging(lines, min_level_value, max_level_value):
    """"""
    output = ''
    while lines:
        line = lines[0]
        if line.lstrip() != PASS_LINE_CONTENTS:
            # not our pass statement here, so just leave the line as-is and keep going
            output += line
            lines = lines[1:]
        else:
            # a logging call will start on the next line: find all the lines it includes and those it does not
            logging_lines, remaining_lines = split_call(lines[1:])
            lines = remaining_lines
            logging_stmt = ''.join(logging_lines)
            original_lines = line + logging_stmt

            # replace the logging statement if its level falls b/w min and max
            if not check_level(logging_stmt, True, min_level_value, max_level_value):
                output += logging_stmt
            else:
                # uncomment_lines of this logging statement and remove the pass line
                uncommented_logging_lines = uncomment_lines(logging_lines)
                logging.info('replacing:\n%s\nwith this:\n%s' % (original_lines.rstrip(), uncommented_logging_lines.rstrip()))
                output += uncommented_logging_lines
    return output
199471
private StringBuilder getLog(StringBuilder stringBuilder) {
		Process p = null;
		BufferedReader reader = null;
		String line = null;  

		try {
			// read output from logcat
			p = Runtime.getRuntime().exec("logcat -d");
			reader = new BufferedReader(  
					new InputStreamReader(p.getInputStream())); 

			stringBuilder.setLength(0);
			while ((line = reader.readLine()) != null) {  
				stringBuilder.append(line); 
			}
			reader.close();

			// read error from logcat
			StringBuilder errorLog = new StringBuilder();
			reader = new BufferedReader(new InputStreamReader(
					p.getErrorStream()));
			errorLog.append("logcat returns error: ");
			while ((line = reader.readLine()) != null) {
				errorLog.append(line);
			}
			reader.close();

			// Exception would be thrown if we get exitValue without waiting for the process
			// to finish
			p.waitFor();

			// if exit value of logcat is non-zero, it means error
			if (p.exitValue() != 0) {
				destroy(p, reader);

				throw new Exception(errorLog.toString());
			}

		} catch (IOException e) {
			e.printStackTrace();
		} catch (InterruptedException e) {
			e.printStackTrace();
		} catch (Exception e) {
			e.printStackTrace();
		}
		destroy(p, reader);
		return stringBuilder;
	}
1355796
def get_loglevel(level):
    
    if level == 'debug':
        return logging.DEBUG
    elif level == 'notice':
        return logging.INFO
    elif level == 'info':
        return logging.INFO
    elif level == 'warning' or level == 'warn':
        return logging.WARNING
    elif level == 'error' or level == 'err':
        return logging.ERROR
    elif level == 'critical' or level == 'crit':
        return logging.CRITICAL
    elif level == 'alert':
        return logging.CRITICAL
    elif level == 'emergency' or level == 'emerg':
        return logging.CRITICAL
    else:
        return logging.INFO
1168983
def c_log(level, message):
    """"""
    c_level = level
    level = LEVELS_F2PY[c_level]
    logger.log(level, message)
740565
def _check_loglevel(level='info'):
    '''
    
    '''
    try:
        level = level.lower()
        if level == 'quiet':
            return None
        else:
            return LOG_LEVELS[level]
    except (AttributeError, KeyError):
        log.error(
            'Invalid output_loglevel \'%s\'. Valid levels are: %s. Falling '
            'back to \'info\'.',
            level, ', '.join(sorted(LOG_LEVELS, reverse=True))
        )
        return LOG_LEVELS['info']