the final log processor that structlog requires to render.
170889
def define_log_renderer(fmt, fpath, quiet):
    
    # it must accept a logger, method_name and event_dict (just like processors)
    # but must return the rendered string, not a dictionary.
    # TODO tty logic

    if fmt:
        return structlog.processors.JSONRenderer()

    if fpath is not None:
        return structlog.processors.JSONRenderer()

    if sys.stderr.isatty() and not quiet:
        return structlog.dev.ConsoleRenderer()

    return structlog.processors.JSONRenderer()
563112
private void processLog() {

        if (!database.isFilesInJar() && fa.isStreamElement(logFileName)) {
            ScriptRunner.runScript(database, logFileName,
                                   ScriptWriterBase.SCRIPT_TEXT_170);
        }
    }
353388
function log() {
	var msg = util.format.apply(null, Array.prototype.slice.call(arguments, 0));
	write(msg);
}
1037405
function logWriteableStream(stream, colorFunction) {
        var write = stream.write;
        
        // The third parameter, callback, will be passed implicitely using arguments
        stream.write = function (chunk, encoding) {
            // Write to STDOUT right away
            try {
                write.apply(this, arguments);
            } catch (streamWriteError) { }
            
            writeToLog(chunk, encoding, colorFunction);
        };
    }
255993
def process_log_record(self, log_record):
        """"""
        log_record["version"] = __version__
        log_record["program"] = PROGRAM_NAME
        log_record["service_name"] = log_record.pop('threadName', None)
        # return jsonlogger.JsonFormatter.process_log_record(self, log_record)

        return log_record
1131602
def do_handle_log(self, workunit, level, *msg_elements):
    """"""
    if not self.is_under_main_root(workunit):
      return

    # If the element is a (msg, detail) pair, we ignore the detail. There's no
    # useful way to display it on the console.
    elements = [e if isinstance(e, six.string_types) else e[0] for e in msg_elements]
    msg = '\n' + ''.join(elements)
    if self.use_color_for_workunit(workunit, self.settings.color):
      msg = self._COLOR_BY_LEVEL.get(level, lambda x: x)(msg)

    self.emit(self._prefix(workunit, msg))
    self.flush()
525979
public void log(final LogNode log) {
        if (log != null) {
            final LogNode scanSpecLog = log.log("ScanSpec:");
            for (final Field field : ScanSpec.class.getDeclaredFields()) {
                try {
                    scanSpecLog.log(field.getName() + ": " + field.get(this));
                } catch (final ReflectiveOperationException e) {
                    // Ignore
                }
            }
        }
    }
1063794
public void output(Logger log)
    {
        Map<String, Entry> entries = config.getSortedEntries();
        
        if ( entries.isEmpty() )
        {
            return;
        }

        ColumnPrinter printer = build(entries);

        log.debug("Configuration Details");
        for ( String line : printer.generate() )
        {
            log.debug(line);
        }
    }
1296025
@Override
  protected void deliverLog(String msg)
  {
    synchronized (_os) {
      try {
        _os.print(msg);
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
  }
1301435
private void recursiveLogResult(StringBuilder buf, Hierarchy<Result> hier, Result result, int depth) {
    if(result == null) {
      buf.append("null");
      LOG.warning("null result!");
      return;
    }
    if(depth > 50) {
      LOG.warning("Probably infinitely nested results, aborting!");
      return;
    }
    for(int i = 0; i < depth; i++) {
      buf.append(' ');
    }
    buf.append(result.getClass().getSimpleName()).append(": ").append(result.getLongName()) //
        .append(" (").append(result.getShortName()).append(")\n");
    if(hier.numChildren(result) > 0) {
      for(It<Result> iter = hier.iterChildren(result); iter.valid(); iter.advance()) {
        recursiveLogResult(buf, hier, iter.get(), depth + 1);
      }
    }
  }
31032
public void debugPrint(final Log log) {
    this.visit(new Visitor() {
      public void visit(Layer layer, int depth) {
        String prefix = repeat('.', depth);
        log.debug(prefix + layer.toString());
      }
    });
  }
947469
def _configure_logger(fmt, quiet, level, fpath,
    pre_hooks, post_hooks, metric_grouping_interval):
    

    # NOTE not thread safe. Multiple BaseScripts cannot be instantiated concurrently.
    level = getattr(logging, level.upper())

    global _GLOBAL_LOG_CONFIGURED
    if _GLOBAL_LOG_CONFIGURED:
        return

    # since the hooks need to run through structlog, need to wrap them like processors
    def wrap_hook(fn):
        @wraps(fn)
        def processor(logger, method_name, event_dict):
            fn(event_dict)
            return event_dict

        return processor

    processors = define_log_processors()
    processors.extend(
        [ wrap_hook(h) for h in pre_hooks ]
    )
    if metric_grouping_interval:
        processors.append(metrics_grouping_processor)

    log_renderer = define_log_renderer(fmt, fpath, quiet)
    stderr_required = (not quiet)
    pretty_to_stderr = (
        stderr_required
        and (
            fmt == "pretty"
            or (fmt is None and sys.stderr.isatty())
        )
    )

    should_inject_pretty_renderer = (
        pretty_to_stderr
        and not isinstance(log_renderer, structlog.dev.ConsoleRenderer)
    )
    if should_inject_pretty_renderer:
        stderr_required = False
        processors.append(StderrConsoleRenderer())

    processors.append(log_renderer)
    processors.extend(
        [ wrap_hook(h) for h in post_hooks ]
    )

    streams = []
    # we need to use a stream if we are writing to both file and stderr, and both are json
    if stderr_required:
        streams.append(sys.stderr)

    if fpath is not None:
        # TODO handle creating a directory for this log file ?
        # TODO set mode and encoding appropriately
        streams.append(open(fpath, 'a'))

    assert len(streams) != 0, "cannot configure logger for 0 streams"

    stream = streams[0] if len(streams) == 1 else Stream(*streams)
    atexit.register(stream.close)

    # a global level struct log config unless otherwise specified.
    structlog.configure(
        processors=processors,
        context_class=dict,
        logger_factory=LevelLoggerFactory(stream, level=level),
        wrapper_class=BoundLevelLogger,
        cache_logger_on_first_use=True,
    )

    # TODO take care of removing other handlers
    stdlib_root_log = logging.getLogger()
    stdlib_root_log.addHandler(StdlibStructlogHandler())
    stdlib_root_log.setLevel(level)

    _GLOBAL_LOG_CONFIGURED = True
54191
private void processStructLogExpressions(final RoundEnvironment roundEnv) {
        for (Element element : roundEnv.getRootElements()) {
            final Map<Name, StructLoggerFieldContext> fields = new HashMap<>();

            for (Element enclosed : element.getEnclosedElements()) {
                if (enclosed.getKind().isField()) {
                        final LoggerContext annotation = enclosed.getAnnotation(LoggerContext.class);
                        if (annotation != null) {
                            final TypeMirror typeMirrorOfField = enclosed.asType();
                            final TypeMirror typeMirrorOfStructlogger = elements.getTypeElement(StructLogger.class.getCanonicalName()).asType();

                            if (!types.isSubtype(typeMirrorOfField, types.erasure(typeMirrorOfStructlogger))) { //check that annotated field is of type StructLogger
                                messager.printMessage(
                                        Diagnostic.Kind.ERROR,
                                        format("field %s in %s should be of type StructLogger", enclosed, element),
                                        enclosed
                                );
                                return;
                            }

                            try {
                                annotation.context(); //throws exception
                                //TODO class is already compiled
                            } catch (MirroredTypeException ex) {
                                final TypeMirror contextProviderTypeMirror = ex.getTypeMirror();

                                //check that type specified by @LoggerContext annotation matches type specified by generic parameter
                                final List<? extends TypeMirror> typeArguments = ((DeclaredType) typeMirrorOfField).getTypeArguments();
                                if (typeArguments.size() != 1) {
                                    messager.printMessage(
                                            Diagnostic.Kind.ERROR,
                                            format("Expected 1 type argument specified in field %s in %s", enclosed, element),
                                            enclosed
                                    );
                                    return;
                                }

                                if (!types.isSameType(typeArguments.get(0), contextProviderTypeMirror)) {
                                    messager.printMessage(
                                            Diagnostic.Kind.ERROR,
                                            format("Generic type of field %s in class %s differs from type specified in @LoggerContext annotation", enclosed, element),
                                            enclosed
                                    );
                                    return;
                                }

                                if (!checkVarContextProvider(contextProviderTypeMirror)) {
                                    return;
                                }
                                fields.put(enclosed.getSimpleName(), new StructLoggerFieldContext(contextProviderTypeMirror));
                            }
                        }

                }
            }

            final TypeElement typeElement = (TypeElement) element;
            final TreePath path = trees.getPath(element);

            // do not do any code replacement in such class which do not specify any LoggerContext annotated StructLogger
            if (!fields.isEmpty()) {
                logInvocationScanner.scan(
                        path,
                        new ScannerParams(
                                typeElement,
                                path.getCompilationUnit(),
                                varsHashMap,
                                fields,
                                generatedClassesInfo
                        )
                );

            }
        }
    }
907426
function genericLog(logger, moduletag, logLevel='info'){
  const isDebug = logLevel==='debug'
  const level = isDebug
    ? 'info'
    : logLevel
  const levelLogger = logger[level]
  const active = isDebug
    ? enabled(moduletag)
    : true

  /**
   * tagged Logger
   * @function taggedLog
   * @param {...string} tags Optional message tags
   */
  function taggedLog(...tags) {
    const tag = normalizeDefaults(tags)
    /**
     * message Logger
     * @function messageLog
     * @template T
     * @param {...T} messages message
     * @returns {T}
     */
    function messageLog(...messages) {
      if (active) {
        const protectedMessage = messageArrayProtect(messages)
        levelLogger(tag, ...protectedMessage)
      }
      return messages[0]
    }
    return messageLog
  }
  /**
   * Array logge Prinst every value on separated line
   * @function mapLog
   * @param {...string} tags Optional message tags
   */
  function mapLog(...tags) {
    /**
     * Array logge Prinst every value on separated line
     * @function printArray
     * @param {Array} message Printed list
     * @returns {Array}
     */
    function printArray(message) {
      if (active) {
        arrayCheck(message)
        const tag = normalizeDefaults(tags)
        //count length + 2. Also handles edge case with objects without 'length' field
        const spaceLn = P(
          length,
          defaultTo(0),
          add(2) )
        const ln = sum( map( spaceLn, tags ) )
        const spaces = new Array(ln)
          .fill(' ')
          .join('')

        const getFormatted = num => chalk.green(`<${num}>`)
        levelLogger( tag, getFormatted(0), head( message ) )
        const printTail = (e, i) => levelLogger(spaces, getFormatted(i+1), e)

        P(
          tail,
          indexedMap(printTail)
        )(message)
      }
      return message
    }
    return printArray
  }
  taggedLog.map = mapLog
  return taggedLog
}
341927
function log() {
    var _console;

    if (LatticeLogs.failFast(LatticeLogs.LOG)) return;

    for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
      args[_key3] = arguments[_key3];
    }

    (_console = console).log.apply(_console, (0, _toConsumableArray2.default)(args.map(LatticeLogs.argMapper)));
  }
991071
function log(type) {
  var messages = Array.prototype.slice.call(arguments);
  messages.shift();
  // Concatenate default strings and first message argument into
  // one string so we can use `printf`-like replacement
  var first = "JPM [" + type + "] " + (messages.shift() + "");

  if (process.env.NODE_ENV !== "test") {
    console.log.apply(console, [first].concat(messages)); // eslint-disable-line no-console
  }
}
1177239
protected void finishScanPaths(final LogNode log) {
        if (log != null) {
            if (whitelistedResources.isEmpty() && whitelistedClassfileResources.isEmpty()) {
                log.log(scanSpec.enableClassInfo ? "No whitelisted classfiles or resources found"
                        : "Classfile scanning is disabled, and no whitelisted resources found");
            } else if (whitelistedResources.isEmpty()) {
                log.log("No whitelisted resources found");
            } else if (whitelistedClassfileResources.isEmpty()) {
                log.log(scanSpec.enableClassInfo ? "No whitelisted classfiles found"
                        : "Classfile scanning is disabled");
            }
        }
        if (log != null) {
            log.addElapsedTime();
        }
    }