log processors that structlog executes before final rendering
429743
def define_log_processors():
    
    # these processors should accept logger, method_name and event_dict
    # and return a new dictionary which will be passed as event_dict to the next one.
    return [
        structlog.processors.TimeStamper(fmt="iso"),
        _structlog_default_keys_processor,
        structlog.stdlib.PositionalArgumentsFormatter(),
        structlog.processors.StackInfoRenderer(),
        structlog.processors.format_exc_info,
    ]
1082108
def _log(self,
             level,
             fmt,
             args=None,
             extra=None,
             exc_info=None,
             inc_stackinfo=False,
             inc_multiproc=False):
        
        if not self.enabled:
            return # Fail silently so that logging can easily be removed

        log_record = self._make_record(
          level, fmt, args, extra, exc_info, inc_stackinfo, inc_multiproc)

        logstr = log_record['defaultfmt'].format(**log_record) #whoah.

        if self.keep_history:
            self.history.append(logstr)

        log_funcs = self.config[level]
        to_remove = []
        for lf in log_funcs:
            try:
                lf.send(logstr)
            except StopIteration:
                # in the case that the log function is already closed, add it
                # to the list of functions to be deleted.
                to_remove.append(lf)
        for lf in to_remove:
            self.remove(level, lf)
            self.info('Logging function {} removed from level {}', lf, level)
55548
private void writeTaskPredecessors(Task record)
   {
      m_buffer.setLength(0);
      //
      // Write the task predecessor
      //
      if (!record.getSummary() && !record.getPredecessors().isEmpty())
      { // I don't use summary tasks for SDEF
         m_buffer.append("PRED ");
         List<Relation> predecessors = record.getPredecessors();

         for (Relation pred : predecessors)
         {
            m_buffer.append(SDEFmethods.rset(pred.getSourceTask().getUniqueID().toString(), 10) + " ");
            m_buffer.append(SDEFmethods.rset(pred.getTargetTask().getUniqueID().toString(), 10) + " ");
            String type = "C"; // default finish-to-start
            if (!pred.getType().toString().equals("FS"))
            {
               type = pred.getType().toString().substring(0, 1);
            }
            m_buffer.append(type + " ");

            Duration dd = pred.getLag();
            double duration = dd.getDuration();
            if (dd.getUnits() != TimeUnit.DAYS)
            {
               dd = Duration.convertUnits(duration, dd.getUnits(), TimeUnit.DAYS, m_minutesPerDay, m_minutesPerWeek, m_daysPerMonth);
            }
            Double days = Double.valueOf(dd.getDuration() + 0.5); // Add 0.5 so half day rounds up upon truncation
            Integer est = Integer.valueOf(days.intValue());
            m_buffer.append(SDEFmethods.rset(est.toString(), 4) + " "); // task duration in days required by USACE
         }
         m_writer.println(m_buffer.toString());
      }
   }
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)));
  }
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
                }
            }
        }
    }
1086574
def _find_logs(self, compile_workunit):
    """"""
    for idx, workunit in enumerate(compile_workunit.children):
      for output_name, outpath in workunit.output_paths().items():
        if output_name in ('stdout', 'stderr'):
          yield idx, workunit.name, output_name, outpath
53021
function findPreprocs(inst, list, procs, parts) {
    if (Array.isArray(list)) {
        while (list.length > 0) {
            var part = list.shift();
            // Preprocessors must be the first elements in the list;
            // if we hit any non-preprocessors, immediately assume
            // we're done preprocessing and can move on with execution
            // This is as opposed to doing something like hoisting
            if (!_isFunc(part)) {
                list.unshift(part);
                break;
            }
            var name = _getFnName(part);
            var lookup = inst.library.lookupPreprocessor(name);

            if (!lookup) {
                list.unshift(part);
                break;
            }
            if (lookup) {
                parts.push(part);
                procs.push(lookup);
            }
        }
    }
    return {
        list: list,
        parts: parts,
        procs: procs
    };
}
323229
def log_before_after(name: str, desc: str):
    """"""

    def func_decorator(f):
        """Wrapper stub."""

        @ft.wraps(f)
        def wrapper(*args, **kwargs):
            """Wrapper stub."""
            LOG.info("\n%s - %s", name, desc)
            res = f(*args, **kwargs)
            if StepResult.ERROR not in res:
                LOG.info("%s - OK\n", name)
            else:
                LOG.error("%s - ERROR\n", name)
            return res

        return wrapper

    return func_decorator
859804
function initPreprocessorQueues(oView, mSettings) {
		var oViewClass = oView.getMetadata().getClass();

		function resolvePreprocessors(oPreprocessor) {
			oPreprocessor.preprocessor = initPreprocessor(oPreprocessor, mSettings.async);
		}

		// shallow copy to avoid issues when manipulating the internal object structure
		oView.mPreprocessors = jQuery.extend({}, mSettings.preprocessors);
		for (var _sType in oViewClass.PreprocessorType) {
			// build the array structure
			var sType = oViewClass.PreprocessorType[_sType];
			if (oView.mPreprocessors[sType] && !Array.isArray(oView.mPreprocessors[sType])) {
				oView.mPreprocessors[sType] = [oView.mPreprocessors[sType]];
			} else if (!oView.mPreprocessors[sType]) {
				oView.mPreprocessors[sType] = [];
			}
			oView.mPreprocessors[sType].forEach(alignPreprocessorStructure);
			oView.mPreprocessors[sType] = getPreprocessorQueue.call(oView, oViewClass._sType, sType);
			oView.mPreprocessors[sType].forEach(resolvePreprocessors);
		}
	}
467967
function trace() {
    var _console5;

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

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

    (_console5 = console).trace.apply(_console5, (0, _toConsumableArray2.default)(args.map(LatticeLogs.argMapper)));
  }
59644
public void flushTxLog() {
        synchronized (flushCompleteSignal) {
            BufferName enqueueBuffer;
            synchronized (txLogToVEBuf.getPot()) {
                // Enqueue the backup task
                enqueueBuffer = txLogToVEBuf.getEnqueueBuffer(); 
                FlushNowJob flushJob = new FlushNowJob();
                txLogToVEBuf.addAndExecuteWork(flushJob);
            }
            
            try {
                do {
                    log.debug("Waiting for flush to complete in buffer {}", enqueueBuffer);
                    flushCompleteSignal.wait();
                    log.debug("Flush complete in buffer {}", lastFlushedBuffer);
                } while (lastFlushedBuffer != enqueueBuffer);
            } catch (InterruptedException e) {
                BitsyException toThrow = new BitsyException(BitsyErrorCodes.FLUSH_INTERRUPTED, "Exception while waiting for a transaction-log flush to be performed", e);

                log.error("Error while flushing the transaction log", toThrow);

                throw toThrow;
            }
        }        
    }
368863
public static void traversePostOrder(
      AbstractCompiler compiler, Node root, AbstractPostOrderCallbackInterface cb) {
    traverse(compiler, root, makePostOrderCallback(cb));
  }
9640
def visit_Output(self, node, frame):
        
        if self.has_known_extends and frame.require_output_check:
            return

        finalize = self.environment.finalize
        finalize_context = getattr(finalize, 'contextfunction', False)
        finalize_eval = getattr(finalize, 'evalcontextfunction', False)
        finalize_env = getattr(finalize, 'environmentfunction', False)

        if finalize is not None:
            if finalize_context or finalize_eval:
                const_finalize = None
            elif finalize_env:
                def const_finalize(x):
                    return finalize(self.environment, x)
            else:
                const_finalize = finalize
        else:
            def const_finalize(x):
                return x

        # If we are inside a frame that requires output checking, we do so.
        outdent_later = False

        if frame.require_output_check:
            self.writeline('if parent_template is None:')
            self.indent()
            outdent_later = True

        # Try to evaluate as many chunks as possible into a static string at
        # compile time.
        body = []

        for child in node.nodes:
            try:
                if const_finalize is None:
                    raise nodes.Impossible()

                const = child.as_const(frame.eval_ctx)
                if not has_safe_repr(const):
                    raise nodes.Impossible()
            except nodes.Impossible:
                body.append(child)
                continue

            # the frame can't be volatile here, because otherwise the as_const
            # function would raise an Impossible exception at that point
            try:
                if frame.eval_ctx.autoescape:
                    if hasattr(const, '__html__'):
                        const = const.__html__()
                    else:
                        const = escape(const)

                const = const_finalize(const)
            except Exception:
                # if something goes wrong here we evaluate the node at runtime
                # for easier debugging
                body.append(child)
                continue

            if body and isinstance(body[-1], list):
                body[-1].append(const)
            else:
                body.append([const])

        # if we have less than 3 nodes or a buffer we yield or extend/append
        if len(body) < 3 or frame.buffer is not None:
            if frame.buffer is not None:
                # for one item we append, for more we extend
                if len(body) == 1:
                    self.writeline('%s.append(' % frame.buffer)
                else:
                    self.writeline('%s.extend((' % frame.buffer)

                self.indent()

            for item in body:
                if isinstance(item, list):
                    val = repr(native_concat(item))

                    if frame.buffer is None:
                        self.writeline('yield ' + val)
                    else:
                        self.writeline(val + ',')
                else:
                    if frame.buffer is None:
                        self.writeline('yield ', item)
                    else:
                        self.newline(item)

                    close = 0

                    if finalize is not None:
                        self.write('environment.finalize(')

                        if finalize_context:
                            self.write('context, ')

                        close += 1

                    self.visit(item, frame)

                    if close > 0:
                        self.write(')' * close)

                    if frame.buffer is not None:
                        self.write(',')

            if frame.buffer is not None:
                # close the open parentheses
                self.outdent()
                self.writeline(len(body) == 1 and ')' or '))')

        # otherwise we create a format string as this is faster in that case
        else:
            format = []
            arguments = []

            for item in body:
                if isinstance(item, list):
                    format.append(native_concat(item).replace('%', '%%'))
                else:
                    format.append('%s')
                    arguments.append(item)

            self.writeline('yield ')
            self.write(repr(concat(format)) + ' % (')
            self.indent()

            for argument in arguments:
                self.newline(argument)
                close = 0

                if finalize is not None:
                    self.write('environment.finalize(')

                    if finalize_context:
                        self.write('context, ')
                    elif finalize_eval:
                        self.write('context.eval_ctx, ')
                    elif finalize_env:
                        self.write('environment, ')

                    close += 1

                self.visit(argument, frame)
                self.write(')' * close + ', ')

            self.outdent()
            self.writeline(')')

        if outdent_later:
            self.outdent()
238553
function log(err, stdout, stderr, cb) {
              //And handle errors (if any)
              if (err) {
                grunt.log.errorlns(err);
              }
              else if (stderr) {
                grunt.log.errorlns(stderr);
              }
              else {
                //Otherwise load a lodash template
                var template = grunt.file.read(
                  __dirname +
                  '/view/binders.lodash');
                
                //process it with the hulk result
                var result = grunt.template.process(template, {data: {stdout: stdout}});  
                
                //And write out our bootstrap module
                grunt.file.write(
                  __dirname +
                  '/tasks/binders.js',
                  result
                );
                grunt.log.ok('hulk: generated binders.js');
                cb();
              }
          }
1314098
function initApi(opts) {
	var logMarker = require.emitter.id + ':' + process.pid
	log = function () {
		console.log(logMarker, util.format.apply(this, Array.prototype.slice.call(arguments)))
	}
	var logger

	if (Array.isArray(opts.ignoredSignals)) 	opts.ignoredSignals.forEach(function (signal) {
		process.on(signal, getSignalHandler(signal))
	})


	if (process.send) {
		logger = new rotatedlogger.RotatedLog({stdout: false, file: true, streamOpts: {logFile: opts.logName}})

		process.stdin.setEncoding('utf-8') // returns undefined
		process.stdin.on('data', stdinDataListener) // returns this
			.once('close', stdinCloseListener)
			.resume()
		process.send('ok') // let parent know we are ready
	} else {
		log('Fatal: ipc not available')
		shutdown()
	}

	function stdinDataListener(data) {
		logger.write(data)
	}
	function stdinCloseListener() {
		log('Detected pipe close')
		logger.write('Log pipe close event ' + (new Date).toISOString())
		logger.close(cleanup)
	}

	function cleanup(err) {
		if (err) log('logger.close:', err)
		process.stdin.removeListener('data', stdinDataListener)
		process.stdin.removeListener('close', stdinCloseListener)
		process.stdin.pause()
		logger = null
		shutdown()
	}

	function shutdown() {
		apprunner.shutdown()
	}
}
136603
private void processPredecessors(Gantt gantt)
   {
      for (Gantt.Tasks.Task ganttTask : gantt.getTasks().getTask())
      {
         String predecessors = ganttTask.getP();
         if (predecessors != null && !predecessors.isEmpty())
         {
            String wbs = ganttTask.getID();
            Task task = m_taskMap.get(wbs);
            for (String predecessor : predecessors.split(";"))
            {
               Task predecessorTask = m_projectFile.getTaskByID(Integer.valueOf(predecessor));
               task.addPredecessor(predecessorTask, RelationType.FINISH_START, ganttTask.getL());
            }
         }
      }
   }
1310113
def _finalize():
    """"""
    from .memory import MemBlock
    from pyrtl.corecircuits import select
    for lhs in _predicate_map:
        # handle memory write ports
        if isinstance(lhs, MemBlock):
            p, (addr, data, enable) = _predicate_map[lhs][0]
            combined_enable = select(p, truecase=enable, falsecase=Const(0))
            combined_addr = addr
            combined_data = data

            for p, (addr, data, enable) in _predicate_map[lhs][1:]:
                combined_enable = select(p, truecase=enable, falsecase=combined_enable)
                combined_addr = select(p, truecase=addr, falsecase=combined_addr)
                combined_data = select(p, truecase=data, falsecase=combined_data)

            lhs._build(combined_addr, combined_data, combined_enable)

        # handle wirevector and register assignments
        else:
            if isinstance(lhs, Register):
                result = lhs  # default for registers is "self"
            elif isinstance(lhs, WireVector):
                result = 0  # default for wire is "0"
            else:
                raise PyrtlInternalError('unknown assignment in finalize')
            predlist = _predicate_map[lhs]
            for p, rhs in predlist:
                result = select(p, truecase=rhs, falsecase=result)
            lhs._build(result)