Module: Flappy::IOSLogger

Included in:
Util::ClassMethods
Defined in:
lib/flappy/util/iOS_logger.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#logger_iOSObject

Returns the value of attribute logger_iOS.



6
7
8
# File 'lib/flappy/util/iOS_logger.rb', line 6

def logger_iOS
  @logger_iOS
end

#logger_iOS_archiveObject

Returns the value of attribute logger_iOS_archive.



8
9
10
# File 'lib/flappy/util/iOS_logger.rb', line 8

def logger_iOS_archive
  @logger_iOS_archive
end

#logger_iOS_buildObject

Returns the value of attribute logger_iOS_build.



7
8
9
# File 'lib/flappy/util/iOS_logger.rb', line 7

def logger_iOS_build
  @logger_iOS_build
end

#logger_iOS_podObject

Returns the value of attribute logger_iOS_pod.



9
10
11
# File 'lib/flappy/util/iOS_logger.rb', line 9

def logger_iOS_pod
  @logger_iOS_pod
end

Instance Method Details

#initialize_iOS_logger(options) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/flappy/util/iOS_logger.rb', line 11

def initialize_iOS_logger(options)
  @options = options

  #### common
  log_file = File.open(File.join(@app_output_archive_log_path, "#{@start_time}_log.txt"), 'a')
  if options[:quiet] || options[:'no-savelog']
    log_file = '/dev/null' if options[:'no-savelog']
    Flappy.logger_iOS  = Logger.new(log_file)
  else
    Flappy.logger_iOS = Logger.new Flappy::MultiIO::MultiDelegator.delegate(:write, :close).to(STDOUT, log_file)
  end
  Flappy.logger_iOS.level = options[:verbose] ? Logger::INFO : Logger::ERROR


  ##### build
  log_file = File.open(File.join(@app_output_archive_log_path, "#{@start_time}_log_build.txt"), "a")
  if options[:quiet] || options[:'no-savelog']
    log_file = '/dev/null' if options[:'no-savelog']
    Flappy.logger_iOS_build  = Logger.new(log_file)
  else
    Flappy.logger_iOS_build = Logger.new Flappy::MultiIO::MultiDelegator.delegate(:write, :close).to(STDOUT, log_file)
  end
  Flappy.logger_iOS_build.level = options[:verbose] ? Logger::INFO : Logger::ERROR


  ##### archive
  log_file = File.open(File.join(@app_output_archive_log_path, "#{@start_time}_log_archive.txt"), "a")
  if options[:quiet] || options[:'no-savelog']
    log_file = '/dev/null' if options[:'no-savelog']
    Flappy.logger_iOS_archive  = Logger.new(log_file)
  else
    Flappy.logger_iOS_archive = Logger.new Flappy::MultiIO::MultiDelegator.delegate(:write, :close).to(STDOUT, log_file)
  end
  Flappy.logger_iOS_archive.level = options[:verbose] ? Logger::INFO : Logger::ERROR


  ##### pod
  log_file = File.open(File.join(@app_output_archive_log_path, "#{@start_time}_log_pod.txt"), "a")
  if options[:quiet] || options[:'no-savelog']
    log_file = '/dev/null' if options[:'no-savelog']
    Flappy.logger_iOS_pod  = Logger.new(log_file)
  else
    Flappy.logger_iOS_pod = Logger.new Flappy::MultiIO::MultiDelegator.delegate(:write, :close).to(STDOUT, log_file)
  end
  Flappy.logger_iOS_pod.level = options[:verbose] ? Logger::INFO : Logger::ERROR
end

#log_iOS(expression) ⇒ Object



59
60
61
62
63
64
65
# File 'lib/flappy/util/iOS_logger.rb', line 59

def log_iOS(expression)
  if logger_iOS.nil?
    return
  end
  logger_iOS.info "#{expression}"
  puts "#{expression}"
end

#log_iOS_archive(command) ⇒ Object



82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/flappy/util/iOS_logger.rb', line 82

def log_iOS_archive(command)
  if logger_iOS_archive.nil?
    return
  end
  if @options[:quiet] || @options[:'no-savelog']
    if @options[:quiet]
      logger_iOS_archive.info `#{command}`
    else
      system(command)
    end
  else
    logger_iOS_archive.info `#{command}`
  end
end

#log_iOS_build(command) ⇒ Object



67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/flappy/util/iOS_logger.rb', line 67

def log_iOS_build(command)
  if logger_iOS_build.nil?
    return
  end
  if @options[:quiet] || @options[:'no-savelog']
    if @options[:quiet]
      logger_iOS_build.info `#{command}`
    else
      system(command)
    end
  else
    logger_iOS_build.info `#{command}`
  end
end

#log_iOS_pod(command) ⇒ Object



97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/flappy/util/iOS_logger.rb', line 97

def log_iOS_pod(command)
  if logger_iOS_pod.nil?
    return
  end
  if @options[:quiet] || @options[:'no-savelog']
    if @options[:quiet]
      logger_iOS_pod.info `#{command}`
    else
      system(command)
    end
  else
    logger_iOS_pod.info `#{command}`
  end
end