def _print mode, text, opts, caler, bind, cfg
      log_ = opts&NOLOG==0
      print_ = opts&NOPRINT==0
      str = cfg.fmt.dup
      str.gsub! "%mode", @highlight[mode]
      if bind
        text = bind.report text
      elsif !text.is String
        text = text.inspect
      elsif cfg.detect_comments and text =~ /\A[ \t]*#[ \t]+\S/
        text = "\n" + @c.green(text.gsub(/^([ \t]*#[ \t])?/, cfg.precede_comments).chop)
      end
      out = cfg.out
      if cfg._time or cfg.path_format
        now = Time.now
        if cfg._time
          time = now.strftime cfg.tf[0]
          time << ".#{cfg.tf[1]%[now.usec/1000]}" if cfg.tf[1]
          str.gsub! "%time", time
        end
        out = now.strftime cfg.out if cfg.path_format
      end
      if caler
        caler.sub!(/block (?:\((\d+) levels\) )?in/) {"{#{$1||1}}"}
        str.gsub! "%caller", caler.sub(String::SIMPLE_CALLER_RE, cfg.cf)
      end
      str.gsub! "%text", text
      str << "\n" if opts&INLINE==0
      log_str = cfg.color_out ? str : @c.clean(str)
      RMTools.write out, log_str if log_
      Kernel::print str if print_
    end
def _print mode, text, opts, caler, bind, cfg
      log_ = opts&NOLOG==0
      print_ = opts&NOPRINT==0
      str = cfg.fmt.dup
      str.gsub! "%mode", @highlight[mode]
      if bind
        text = bind.report text
      elsif !text.is String
        text = text.inspect
      elsif cfg.detect_comments and text =~ /\A[ \t]*#[ \t]+\S/
        text = "\n" + @c.green(text.gsub(/^([ \t]*#[ \t])?/, cfg.precede_comments).chop)
      end
      out = cfg.out
      if cfg._time or cfg.path_format
        now = Time.now
        if cfg._time
          time = now.strftime cfg.tf[0]
          time << ".#{cfg.tf[1]%[now.usec/1000]}" if cfg.tf[1]
          str.gsub! "%time", time
        end
        out = now.strftime cfg.out if cfg.path_format
      end
      if caler
        caler.sub!(/block (?:\((\d+) levels\) )?in/) {"{#{$1||1}}"}
        str.gsub! "%caller", caler.sub(String::SIMPLE_CALLER_RE, cfg.cf)
      end
      str.gsub! "%text", text
      str << "\n" if opts&INLINE==0
      log_str = cfg.color_out ? str : @c.clean(str)
      RMTools.write out, log_str if log_
      Kernel::print str if print_
    end
TODO: добавить фильтров,
 например, для обработки текста, который будет логирован