Class: BigKeeper::LeanCloudLogger

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/big_keeper/util/leancloud_logger.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#commandObject

Returns the value of attribute command.



10
11
12
# File 'lib/big_keeper/util/leancloud_logger.rb', line 10

def command
  @command
end

#end_timestampObject

Returns the value of attribute end_timestamp.



10
11
12
# File 'lib/big_keeper/util/leancloud_logger.rb', line 10

def end_timestamp
  @end_timestamp
end

#is_successObject

Returns the value of attribute is_success.



10
11
12
# File 'lib/big_keeper/util/leancloud_logger.rb', line 10

def is_success
  @is_success
end

#parameterObject

Returns the value of attribute parameter.



10
11
12
# File 'lib/big_keeper/util/leancloud_logger.rb', line 10

def parameter
  @parameter
end

#pathObject

Returns the value of attribute path.



10
11
12
# File 'lib/big_keeper/util/leancloud_logger.rb', line 10

def path
  @path
end

#start_timestampObject

Returns the value of attribute start_timestamp.



10
11
12
# File 'lib/big_keeper/util/leancloud_logger.rb', line 10

def start_timestamp
  @start_timestamp
end

#userObject

Returns the value of attribute user.



10
11
12
# File 'lib/big_keeper/util/leancloud_logger.rb', line 10

def user
  @user
end

#versionObject

Returns the value of attribute version.



10
11
12
# File 'lib/big_keeper/util/leancloud_logger.rb', line 10

def version
  @version
end

Instance Method Details

#end_log(is_success) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/big_keeper/util/leancloud_logger.rb', line 24

def end_log(is_success)
  @end_timestamp = Time.new.to_i
  @is_success = is_success
  @version = BigkeeperParser.version if @version == 'Version in Bigkeeper file'

  # require
  parameter = {'start_timestamp' => @start_timestamp, 'end_timestamp' =>@end_timestamp, 'user' =>@user, 'is_success' =>@is_success}

  # optional
  parameter = parameter.merge('command' => @command) unless @command == nil
  parameter = parameter.merge('version' => @version) unless @version == nil || @version == ""
  parameter = parameter.merge('parameter' => @parameter) unless @parameter == nil || @parameter == ""

  leancloud_file = @command.split("/").first

  send_log_cloud(leancloud_file, parameter)
end

#set_command(set_command) ⇒ Object



12
13
14
# File 'lib/big_keeper/util/leancloud_logger.rb', line 12

def set_command(set_command)
  @command = set_command
end

#start_log(global_options, args) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/big_keeper/util/leancloud_logger.rb', line 16

def start_log(global_options, args)
  @start_timestamp = Time.new.to_i
  @user = global_options['user'].to_s
  @parameter = args.join(",")
  @version = global_options['ver']
  @path = global_options['path']
end