logs-cf-plugin 0.0.34.pre → 0.0.35.pre

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ YjQ5NjYzNWRmZjhiZGRjZjRiZWU5Y2MyODczMzI4MTNlODE5YTM3Mg==
5
+ data.tar.gz: !binary |-
6
+ YjMyMDNhMWY2ZWE1NDZmOTFlM2U0OGQ2M2FkNWI2MzA3YjhmZDgwNA==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ YmFmOTgzNWU0MjhkOGUwNTRlZWFhZWMxYmFmMmRjMDBkNTFmNDM0Zjg4NmJm
10
+ YjEyMDkyZjIxYjZhMTU1OGY3YmFmZjJmNWVlYjAzZDEwYzA2YmIwOWJiNTFj
11
+ NDJkZGNjYzY2OTJmYTIzMDVjYjRhZmJiNGJhM2VmOWM4YWE1ODc=
12
+ data.tar.gz: !binary |-
13
+ YjEwMDYyZDdkY2M5MGQ3NzNmZWFhMDM5OTQxZDlhYjJjMTNlNTk2M2RmZjA2
14
+ MmNmM2MwMThmNGI1YzM0NjExNGMwNDc2OGE2OWNhZmYwYjQ4ODliZWRjNzUw
15
+ MTZlM2E0ZmRjNGNkNzc4OTRiNmY3ODAwMWI2MGJlMTY1MTQzMTU=
@@ -1,21 +1,29 @@
1
1
  module LogsCfPlugin
2
2
  class LogTarget
3
- def initialize(app_id)
4
- @app_id = app_id
3
+ def initialize(app)
4
+ @app = app
5
5
  end
6
6
 
7
7
  def valid?
8
- !@app_id.nil?
8
+ !app_id.nil?
9
9
  end
10
10
 
11
11
  def query_params
12
- {app: @app_id}
12
+ {app: app_id}
13
+ end
14
+
15
+ def app_id
16
+ @app.try(:guid)
17
+ end
18
+
19
+ def app_name
20
+ @app.try(:name)
13
21
  end
14
22
 
15
23
  private
16
24
 
17
25
  def target
18
- :app if @app_id
26
+ :app if app_id
19
27
  end
20
28
  end
21
29
  end
@@ -11,11 +11,11 @@ module LogsCfPlugin
11
11
  @use_ssl = use_ssl
12
12
  end
13
13
 
14
- def listen(query_params)
14
+ def listen(log_target)
15
15
  if use_ssl
16
- websocket_address = "wss://#{loggregator_host}:4443/tail/?#{hash_to_query(query_params)}"
16
+ websocket_address = "wss://#{loggregator_host}:4443/tail/?#{hash_to_query(log_target.query_params)}"
17
17
  else
18
- websocket_address = "ws://#{loggregator_host}/tail/?#{hash_to_query(query_params)}"
18
+ websocket_address = "ws://#{loggregator_host}/tail/?#{hash_to_query(log_target.query_params)}"
19
19
  end
20
20
 
21
21
  output.puts "websocket_address: #{websocket_address}" if trace
@@ -33,7 +33,7 @@ module LogsCfPlugin
33
33
  ws.on :message do |event|
34
34
  begin
35
35
  received_message = LogMessage.decode(event.data.pack("C*"))
36
- write(output, received_message)
36
+ write(log_target, output, received_message)
37
37
  rescue Beefcake::Message::WrongTypeError, Beefcake::Message::RequiredFieldNotSetError, Beefcake::Message::InvalidValueError
38
38
  output.puts("Error parsing data. Please ensure your gem is the latest version.")
39
39
  ws.close
@@ -63,9 +63,9 @@ module LogsCfPlugin
63
63
  }
64
64
  end
65
65
 
66
- def dump_messages(query_params)
66
+ def dump_messages(log_target)
67
67
  prefix = use_ssl ? 'https' : 'http'
68
- uri = URI.parse("#{prefix}://#{loggregator_host}/dump/?#{hash_to_query(query_params)}")
68
+ uri = URI.parse("#{prefix}://#{loggregator_host}/dump/?#{hash_to_query(log_target.query_params)}")
69
69
  http = Net::HTTP.new(uri.host, uri.port)
70
70
  http.use_ssl = use_ssl
71
71
  http.verify_mode = OpenSSL::SSL::VERIFY_NONE
@@ -106,7 +106,7 @@ module LogsCfPlugin
106
106
  end
107
107
 
108
108
  messages.each do |m|
109
- write(output, m)
109
+ write(log_target, output, m)
110
110
  end
111
111
  rescue Beefcake::Message::WrongTypeError, Beefcake::Message::RequiredFieldNotSetError, Beefcake::Message::InvalidValueError
112
112
  output.puts("Error parsing data. Please ensure your gem is the latest version.")
@@ -2,8 +2,8 @@ require "cf/cli"
2
2
 
3
3
  module MessageWriter
4
4
  include CF::Interactive
5
- def write(output, message)
6
- msg = [message.app_id, message.source_type_name, message.source_id, message.message_type_name, message.message].join(" ")
5
+ def write(log_target, output, message)
6
+ msg = [log_target.app_name, message.source_type_name, message.source_id, message.message_type_name, message.message].join(" ")
7
7
  msg = c(msg, :error) if message.message_type == LogMessage::MessageType::ERR
8
8
  output.puts(msg)
9
9
  end
@@ -20,9 +20,9 @@ module LogsCfPlugin
20
20
 
21
21
  def logs
22
22
  client.current_organization.name # resolve org name so CC will validate AuthToken
23
- app_id = input[:app].try(:guid)
24
23
 
25
- log_target = LogTarget.new(app_id)
24
+
25
+ log_target = LogTarget.new(input[:app])
26
26
 
27
27
  unless log_target.valid?
28
28
  Mothership::Help.command_help(@@commands[:logs])
@@ -32,9 +32,9 @@ module LogsCfPlugin
32
32
  loggregator_client = LoggregatorClient.new(loggregator_host, client.token.auth_header, STDOUT, input[:trace], use_ssl)
33
33
 
34
34
  if input[:recent]
35
- loggregator_client.dump_messages(log_target.query_params)
35
+ loggregator_client.dump_messages(log_target)
36
36
  else
37
- loggregator_client.listen(log_target.query_params)
37
+ loggregator_client.listen(log_target)
38
38
  end
39
39
  end
40
40
 
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logs-cf-plugin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.34.pre
5
- prerelease: 7
4
+ version: 0.0.35.pre
6
5
  platform: ruby
7
6
  authors:
8
7
  - Pivotal
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-08-29 00:00:00.000000000 Z
11
+ date: 2013-08-30 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: cf
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: faye-websocket
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ~>
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ~>
44
39
  - !ruby/object:Gem::Version
@@ -46,7 +41,6 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: beefcake
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ~>
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ~>
60
53
  - !ruby/object:Gem::Version
@@ -62,7 +55,6 @@ dependencies:
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: loggregator_messages
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
59
  - - ~>
68
60
  - !ruby/object:Gem::Version
@@ -70,7 +62,6 @@ dependencies:
70
62
  type: :runtime
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
66
  - - ~>
76
67
  - !ruby/object:Gem::Version
@@ -90,27 +81,26 @@ files:
90
81
  homepage: http://github.com/cloudfoundry/logs-cf-plugin
91
82
  licenses:
92
83
  - Apache 2.0
84
+ metadata: {}
93
85
  post_install_message:
94
86
  rdoc_options: []
95
87
  require_paths:
96
88
  - lib
97
89
  - vendor
98
90
  required_ruby_version: !ruby/object:Gem::Requirement
99
- none: false
100
91
  requirements:
101
92
  - - ! '>='
102
93
  - !ruby/object:Gem::Version
103
94
  version: 1.9.3
104
95
  required_rubygems_version: !ruby/object:Gem::Requirement
105
- none: false
106
96
  requirements:
107
97
  - - ! '>'
108
98
  - !ruby/object:Gem::Version
109
99
  version: 1.3.1
110
100
  requirements: []
111
101
  rubyforge_project:
112
- rubygems_version: 1.8.25
102
+ rubygems_version: 2.0.4
113
103
  signing_key:
114
- specification_version: 3
104
+ specification_version: 4
115
105
  summary: CF Logs
116
106
  test_files: []