Logs a message to stdout, runs the given block, and then prints the time
 it took to run the block.
344250
def benchmark(message)
      start = Time.now
      print(stdout, "#{message} ")
      result = yield
      duration = Time.now - start
      info("✔".green + format(" %0.3fs", duration).gray)
      result
    rescue
      info("✘".red)
      raise
    end
7222
def log(self, msg, *args):
        """"""
        if args:
            msg %= args
        click.echo(msg, file=sys.stderr)
619052
def print_row(value, num_blocks, val_min, color):
    
    if color:
        sys.stdout.write(f'\033[{color}m') # Start to write colorized.

    if num_blocks < 1 and (value > val_min or value > 0):
        # Print something if it's not the smallest
        # and the normal value is less than one.
        sys.stdout.write(SM_TICK)
    else:
        for _ in range(num_blocks):
            sys.stdout.write(TICK)

    if color:
        sys.stdout.write('\033[0m')
1236326
public static void println(String message) {
        synchronized (logSync) {
            if (logWriter != null) {
                logWriter.println(message);

                // automatic flushing is never enabled, so we must do it ourselves
                logWriter.flush();
            }
        }
    }
1363481
def timeit(output):
    
    b = time.time()
    yield
    print output, 'time used: %.3fs' % (time.time()-b)
302194
def log_time(func):
    

    @functools.wraps(func)
    def _execute(*args, **kwargs):
        """Executes function and logs time

        :param args: args of function
        :param kwargs: extra args of function
        :param *args: args
        :param **kwargs: extra args
        :return: function result
        """

        func_name = get_method_name(func)
        timer = Timer()
        log_message(func_name, "has started")

        with timer:
            result = func(*args, **kwargs)

        seconds = "{:.3f}".format(timer.elapsed_time())
        log_message(func_name, "has finished. Execution time:", seconds, "s")

        return result

    return _execute
626439
def run_output(self):
        """"""
        for f in logdissect.output.__formats__:
            ouroutput = self.output_modules[f]
            ouroutput.write_output(self.data_set['finalized_data'],
                    args=self.args)
            del(ouroutput)

        # Output to terminal if silent mode is not set:
        if not self.args.silentmode:
            if self.args.verbosemode:
                print('\n==== ++++ ==== Output: ==== ++++ ====\n')
            for line in self.data_set['finalized_data']['entries']:
                print(line['raw_text'])
149811
def _log(self, message, stream, color=None, newline=False):
        '''
        
        '''

        if color and self.color_term:
            colorend = Logger.COLOR_END
        else:
            color = colorend = ''

        stream.write('{color}{message}{colorend}\n'.format(
            color=color,
            message=message,
            colorend=colorend
        ))

        if newline:
            sys.stdout.write('\n')

        stream.flush()
1070166
def logMsg(self, msg, printMsg=True):
        
        time = datetime.datetime.now().strftime('%I:%M %p')
        self.log = '{0}\n{1} | {2}'.format(self.log, time, msg)
        if printMsg:
            print msg

        if self.addLogsToArcpyMessages:
            from arcpy import AddMessage
            AddMessage(msg)
760191
def log(message, type):
    """"""

    (sys.stdout if type == 'notice' else sys.stderr).write(message + "\n")
397713
private void logBlock(int blockIndex, int startIndex, int blockLength)
   {
      if (m_log != null)
      {
         m_log.println("Block Index: " + blockIndex);
         m_log.println("Length: " + blockLength + " (" + Integer.toHexString(blockLength) + ")");
         m_log.println();
         m_log.println(FastTrackUtility.hexdump(m_buffer, startIndex, blockLength, true, 16, ""));
         m_log.flush();
      }
   }
1363474
def output_before_run(self, run):
        
        # output in terminal
        runSet = run.runSet
        try:
            OutputHandler.print_lock.acquire()

            try:
                runSet.started_runs += 1
            except AttributeError:
                runSet.started_runs = 1

            timeStr = time.strftime("%H:%M:%S", time.localtime()) + "   "
            progressIndicator = " ({0}/{1})".format(runSet.started_runs, len(runSet.runs))
            terminalTitle = TERMINAL_TITLE.format(runSet.full_name + progressIndicator)
            if self.benchmark.num_of_threads == 1:
                util.printOut(terminalTitle + timeStr + self.format_sourcefile_name(run.identifier, runSet), '')
            else:
                util.printOut(terminalTitle + timeStr + "starting   " + self.format_sourcefile_name(run.identifier, runSet))
        finally:
            OutputHandler.print_lock.release()
167341
def log(program, message, exit_status = nil, files = nil)
      File.open(File.join(@log_directory, @log_file), "a") do |log|
        log.puts ""
        log.puts Time.now.to_s + " " + program
        log.puts message
        log.puts ""
      end

      if exit_status
        remove_files(files) unless files.nil?
        exit exit_status.to_i
      end
    end
505903
private static void method() {
//		StopWatch stopWatch = new LoggingStopWatch();
		Split split = SimonManager.getStopwatch("codeBlock2").start();

		try {
			// the code block being timed - this is just a dummy example
			long sleepTime = (long) (Math.random() * 1000L);
			Thread.sleep(sleepTime);
			if (sleepTime > 500L) {
				throw new Exception("Throwing exception");
			}

			split.stop("success");
//			stopWatch.stop("codeBlock2.success", "Sleep time was < 500 ms");
		} catch (Exception e) {
			split.stop("failure");
//			stopWatch.stop("codeBlock2.failure", "Exception was: " + e);
		}
	}
843875
def write(self, message):
        

        self.__thread_local_ctx.write_count += 1

        try:
            if self.__thread_local_ctx.write_count > 1:
                return

            # For each line in the buffer ending with \n, output that line to
            # the logger
            msgs = (self.buffer + message).split('\n')
            self.buffer = msgs.pop(-1)
            for m in msgs:
                self.log_orig(m, echo=True)
        finally:
            self.__thread_local_ctx.write_count -= 1
740420
def on_message(self, message):
        """"""
        json_rpc = json.loads(message)
        logging.log(logging.DEBUG, json_rpc)

        if self.pool is None:
            self.pool = multiprocessing.Pool(processes=args.workers)

        # Spawn a process to protect the server against segfaults
        async = self.pool.apply_async(_worker_process, [json_rpc])
        try:
            result = async.get(timeout=args.timeout)
            error = 0
        except multiprocessing.TimeoutError:
            result = ("File format conversion timed out! This is due "
                      "either to a large input file or a segmentation "
                      "fault in the underlying open babel library.")
            error = 1
            self.pool.terminate()
            self.pool = multiprocessing.Pool(processes=args.workers)
        except Exception:
            result = traceback.format_exc()
            error = 1
        logging.log(logging.DEBUG, result)

        self.write_message(json.dumps({'result': result, 'error': error,
                                       'id': json_rpc['id']},
                                      separators=(',', ':')))
440160
def run(fn, blocksize, seed, c, delta):
    

    with open(fn, 'rb') as f:
        for block in encode.encoder(f, blocksize, seed, c, delta):
            sys.stdout.buffer.write(block)