Sha256: 170a48c1f67ceb715703871be140321d9a8a04f27aa1370f4b09df9d02416e55

Contents?: true

Size: 794 Bytes

Versions: 58

Compression:

Stored size: 794 Bytes

Contents

# encoding: utf-8
module Mutx
  module Support
    module Logs

      def self.path
        "#{Dir.pwd}/mutx/"
      end

      def self.all
        logs = Hash.new
        Dir.glob(path + '*.log') do |log_file|
          name = log_file.split("/").last.gsub('.log','')
          text = File.read(log_file)
          logs[name] = text
        end
        logs
      end

      def self.read_log_file_content_for log=nil
          path = "#{Dir.pwd}/mutx/logs/#{log}.log"
          if File.exist?("#{path}")
            FileUtils.cp(path, "#{path}~")
            all_content = IO.read("#{path}~")[-4000..-1]
            content = all_content.gsub("\n","<br>")
            File.delete("#{path}~")
          else
            content = ""
          end
          content
      end
    end
  end
end

Version data entries

58 entries across 58 versions & 1 rubygems

Version Path
mutx-0.2.9 lib/mutx/support/logs.rb
mutx-0.2.8 lib/mutx/support/logs.rb
mutx-0.2.7 lib/mutx/support/logs.rb
mutx-0.2.6 lib/mutx/support/logs.rb
mutx-0.2.5 lib/mutx/support/logs.rb
mutx-0.2.4 lib/mutx/support/logs.rb
mutx-0.2.3 lib/mutx/support/logs.rb
mutx-0.2.2 lib/mutx/support/logs.rb
mutx-0.2.1 lib/mutx/support/logs.rb
mutx-0.2.0 lib/mutx/support/logs.rb
mutx-0.1.69 lib/mutx/support/logs.rb
mutx-0.1.68 lib/mutx/support/logs.rb
mutx-0.1.67 lib/mutx/support/logs.rb
mutx-0.1.66 lib/mutx/support/logs.rb
mutx-0.1.65 lib/mutx/support/logs.rb
mutx-0.1.64 lib/mutx/support/logs.rb
mutx-0.1.63 lib/mutx/support/logs.rb
mutx-0.1.62 lib/mutx/support/logs.rb
mutx-0.1.61 lib/mutx/support/logs.rb
mutx-0.1.60 lib/mutx/support/logs.rb