Returns a string representation of logs.

        Only displays errors and warnings in the email logs
        to avoid being verbose
173743
def get_email_logs(self):
        '''
        
        '''
        message = ""
        for log in self.record:
            if log["log_type"] in [ERROR, WARNING]:
                message += self.format_message(**log)

        return message
479059
def log(msg, level=0):
    '''
    
    '''

    red = '\033[91m'
    endc = '\033[0m'

    # configure the logging module
    cfg = {
        'version': 1,
        'disable_existing_loggers': False,
        'formatters': {
            'stdout': {
                'format': '[%(levelname)s]: %(asctime)s - %(message)s',
                'datefmt': '%x %X'
            },
            'stderr': {
                'format': red + '[%(levelname)s]: %(asctime)s - %(message)s' + endc,
                'datefmt': '%x %X'
            }
        },
        'handlers': {
            'stdout': {
                'class': 'logging.StreamHandler',
                'level': 'DEBUG',
                'formatter': 'stdout'
            },
            'stderr': {
                'class': 'logging.StreamHandler',
                'level': 'ERROR',
                'formatter': 'stderr'
            }
        },
        'loggers': {
            'info': {
                'handlers': ['stdout'],
                'level': 'INFO',
                'propagate': True
            },
            'error': {
                'handlers': ['stderr'],
                'level': 'ERROR',
                'propagate': False
            }
        }
    }

    dictConfig(cfg)

    lg = 'info' if level == 0 else 'error'
    lvl = 20 if level == 0 else 40

    logger = logging.getLogger(lg)
    logger.log(lvl, msg)
580526
private Object toLogString(HttpRequestMessage httpRequest) {
        StringBuilder b = new StringBuilder();
        b.append(httpRequest.getRequestURI()).append('\n');
        final Map<String,List<String>> headers = httpRequest.getHeaders();
        for ( String h: headers.keySet()) {
            b.append(h).append(':').append(' ').append(headers.get(h)).append('\n');
        }
        return b.toString();
    }
398375
function showLog() {
  let errorLevel = 0;
  let totalErrors = 0;
  errors.forEach((error, i) => {
    totalErrors = i + 1;
    errorLevel = error.errorLevel || errorLevel;
    console.log(`${error.errorLevel ? '⛔' : '⚠'}  ${error.message}`);
    console.log(JSON.stringify(error.entries));
    console.log('*-------------------------*');
  });
  if (errorLevel) {
    throw `⚠ failed because of the ${totalErrors} error${totalErrors > 1 ? 's' : ''} above ⚠`;
  }
  return totalErrors;
}
714757
def my_log_message(verbose, prio, msg):
    
    syslog.syslog(prio, msg)
    if verbose or prio == syslog.LOG_ERR:
        sys.stderr.write("%s\n" % (msg))
1247000
private static String toErrorItemMessage(final String logMessage, final String throwableMessage) {
		
		StringBuilder sb = new StringBuilder();
				
		if ((throwableMessage != null) && (!throwableMessage.isEmpty())) {
			sb.append(throwableMessage);
			
			if ((logMessage != null) && (!logMessage.isEmpty())) {
				sb.append(" (");
				sb.append(logMessage);
				sb.append(")");
			}			
		} else {
			sb.append(logMessage);
		}

		return sb.toString();
	}
557966
def log_error(*error, cause=None):
    
    thread_id = threading.current_thread().ident
    text = " ".join(error)
    if cause:
        text += " due to " + str(cause)

    logger = get_logger()
    logger.error(LOG_THREAD_FORMAT.format(thread_id, text))
1263586
public static String logString(final String string) {
        if (string == null || string.length() == 0) {
            return string;
        }

        String ret = string.replaceAll("[^\\p{Print}]", "?");

        ret = ret.substring(0, Math.min(ret.length(), MAX_LOG_STRING_LENGTH)) + (ret.length() > MAX_LOG_STRING_LENGTH ? "..." : "");

        return ret;

    }
1294463
def deferred_emails():
    """"""
    status = SERVER_STATUS['OK']
    count = Message.objects.deferred().count()

    if DEFERRED_WARNING_THRESHOLD <= count < DEFERRED_DANGER_THRESHOLD:
        status = SERVER_STATUS['WARNING']
    if count >= DEFERRED_DANGER_THRESHOLD:
        status = SERVER_STATUS['DANGER']

    return {
        'label': 'Deferred Email',
        'status': status,
        'info': 'There are currently {0} deferred messages.'.format(count)
    }
384234
function logs(a) {
  return a.isIgnored?         ''
  :      a.log.length === 0?  ''
  :      /* otherwise */      '\n' + pad( 2
                                        , '=== Captured logs:\n'
                                        + a.log.map(function(x){
                                            return faded('- ' + show(x.log))})
                                          .join('\n') + '\n---\n')
}
972191
def _log_request(self, request):
        
        msg = []
        for d in self.LOG_DATA:
            val = getattr(request, d)
            if val:
                msg.append(d + ': ' + repr(val))
        for d in self.LOG_HEADERS:
            if d in request.headers and request.headers[d]:
                msg.append(d + ': ' + repr(request.headers[d]))
        logger.info("Request information: %s", ', '.join(msg))
227188
def str_def(self):
        
        return "classname={!r}; read_timeout={!r}; read_retries={!r}; " \
            "message={!r};". \
            format(self.__class__.__name__, self.read_timeout,
                   self.read_retries, self.args[0])
380750
def get_log(self):
        
        log_path = self.meta_data['logs_resource']
        conn = Qubole.agent()
        r = conn.get_raw(log_path)
        return r.text
95906
def str_def(self):
        
        return "classname={!r}; line={!r}; column={!r}; message={!r};". \
            format(self.__class__.__name__, self.line, self.column,
                   self.args[0])
438835
def log_fault_info_str (exc_info, message = "", level = logging.CRITICAL,
                        traceback = False):
  
  tb = sys.exc_info ()[2]
  stack = _get_stack (tb)
  rc = StringIO ()
  rc.write ("%s: FAULT: %s%s(%s): %s\n"
            % (logging.getLevelName (level),
               ("%s -- " % message) if message else "",
               tb.tb_frame.f_code.co_filename,
               tb.tb_lineno,
               repr (exc_info[1])))
  if traceback:
    for line in _generate_stackdump (stack):
      rc.write ("%s\n" % line)
  return rc.getvalue ()
1268258
def log(self, message, result_code, log_message=""):
        
        return self.create(
            message_data=message.message_data,
            message_id=get_message_id(message.email),
            when_added=message.when_added,
            priority=message.priority,
            # @@@ other fields from Message
            result=result_code,
            log_message=log_message,
        )
329465
public String toLoggableString()
    {
        StringBuilder connectionStringBuilder = new StringBuilder();
        if (this.endpoint != null)
        {
            connectionStringBuilder.append(String.format(Locale.US, "%s%s%s%s", ENDPOINT_CONFIG_NAME, KEY_VALUE_SEPARATOR,
                    this.endpoint.toString(), KEY_VALUE_PAIR_DELIMITER));
        }

        if (!StringUtil.isNullOrWhiteSpace(this.entityPath))
        {
            connectionStringBuilder.append(String.format(Locale.US, "%s%s%s%s", ENTITY_PATH_CONFIG_NAME,
                    KEY_VALUE_SEPARATOR, this.entityPath, KEY_VALUE_PAIR_DELIMITER));
        }
        
        return connectionStringBuilder.toString();
    }