foreign_office 0.15.10 → 0.15.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 41ae26382de688baf1b41116375fbe87089f9c09
4
- data.tar.gz: 3c4e36de4d98efcd857d43b8302f2c61138b89bd
3
+ metadata.gz: 7f8762a300288dfafad5cd1c5ce761d831f31e20
4
+ data.tar.gz: 0bf98d391c89d944c27e04c960114df8f10af5a2
5
5
  SHA512:
6
- metadata.gz: cbbbd265379d9b2d179aa7489aeb971c5e4f7ecfe0eba8c7ea920a4729538405a157bde0677129bb245ba218b8b98e823baed24b2ac706aaedcfacdcfe05ae4a
7
- data.tar.gz: cdce665b19bc083eff699169a1caddcfad53c01f33796851c17622c3ba3c8c6e5b359f8c8933ed0fef4b6219331fe2700edce829d8ee5b2c32f862a5813b1796
6
+ metadata.gz: 751dca65d0d5b78cd39efcdbb18617905e31d18be32e685b0b4d2bf8bd5669fc46068efbcff1cc34ff62cc3d291d32f689d68a90a536c6f5b854152268eb3527
7
+ data.tar.gz: 8f2f1dc2b2d5a871792ef6146c0764c004b81da88f1854388dbf0c3a38bd0dc9ef20adedfdef3ecd4a4e0c1c1db6277e279a9b259536bc7cb39c21ad184dc9ab
@@ -7,12 +7,22 @@ var DebugLogger = Class.extend({
7
7
  if($debug_settings.data('logging_on')){
8
8
  console.log('Debug logging turned on.')
9
9
  this.logging_on = true;
10
+ this.logger_level = $debug_settings.data('logger_level') || 1;
11
+ this.allows = $debug_settings.data('logger_include');
10
12
  } else {
11
13
  this.logging_on = false;
12
14
  }
13
15
  },
14
- log: function(msg){
15
- if(this.logging_on){
16
+ log: function(msg, level, source){
17
+ if(level === undefined){
18
+ level = 0;
19
+ }
20
+ if(source === undefined || this.allows === undefined){
21
+ source_allowed = true;
22
+ }else{
23
+ source_allowed = this.allows[source];
24
+ }
25
+ if(this.logging_on && this.logger_level >= level && source_allowed){
16
26
  console.log(msg)
17
27
  }
18
28
  }
@@ -10,9 +10,9 @@ var ForeignOffice = Class.extend({
10
10
  this.session_id = $('meta[name="client_id"]').attr('content')
11
11
  },
12
12
  config: function(config){
13
- debug_logger.log("Using Foreign Office js config:")
14
- debug_logger.log(config);
15
- bus_class = eval(config.bus_name);
13
+ debug_logger.log("Using Foreign Office js config:", 1, 'foreign-office')
14
+ debug_logger.log(config, 1, 'foreign-office');
15
+ bus_class = eval(config.bus_name, 1);
16
16
 
17
17
  try {
18
18
  bus_class_name = bus_class.third_party_library
@@ -23,7 +23,7 @@ var ForeignOffice = Class.extend({
23
23
  bus_class_name = 'TestBus'
24
24
  bus_class = TestBus
25
25
  }
26
- debug_logger.log("Connecting to message bus using " + bus_class_name)
26
+ debug_logger.log("Connecting to message bus using " + bus_class_name, 1, 'foreign-office')
27
27
  this.bus = new bus_class(config);
28
28
  if(typeof config.disconnect_alert != 'undefined'){
29
29
  this.disconnect_alert = config.disconnect_alert
@@ -87,8 +87,8 @@ foreign_office = new ForeignOffice();
87
87
  var ForeignOfficeChannel = Class.extend({
88
88
  init: function(channel_name){
89
89
  var foreign_office_channel = this;
90
- debug_logger.log("Subscribing to: ");
91
- debug_logger.log(channel_name);
90
+ debug_logger.log("Subscribing to: ", 1, 'foreign-office');
91
+ debug_logger.log(channel_name, 1, 'foreign-office');
92
92
  foreign_office.bus.subscribe({
93
93
  channel : channel_name,
94
94
  //If the bus binds the callback to the channel object...
@@ -100,11 +100,11 @@ var ForeignOfficeChannel = Class.extend({
100
100
  this.listeners = [];
101
101
  },
102
102
  handleMessage: function(m){
103
- debug_logger.log("Got a message: ");
104
- debug_logger.log(m);
103
+ debug_logger.log("Got a message: ", 1, 'foreign-office');
104
+ debug_logger.log(m, 1, 'foreign-office');
105
105
  $.each(this.listeners,function(i,listener){
106
- debug_logger.log("sending message to listener: ");
107
- debug_logger.log(listener);
106
+ debug_logger.log("sending message to listener: ", 1, 'foreign-office');
107
+ debug_logger.log(listener, 1, 'foreign-office');
108
108
  listener.handleMessage(m);
109
109
  })
110
110
  },
@@ -1,7 +1,7 @@
1
1
  var PubnubBus = Class.extend({
2
2
  init: function(config){
3
3
  var pubnubbus = this
4
- debug_logger.log("initializing pubnub js with client id: " + foreign_office.session_id)
4
+ debug_logger.log("initializing pubnub js with client id: " + foreign_office.session_id, 1, 'foreign-office')
5
5
  this.pubnub = new PubNub({
6
6
  publish_key : config.publish_key,
7
7
  subscribe_key : config.subscribe_key,
@@ -9,7 +9,7 @@ var PubnubBus = Class.extend({
9
9
  uuid : foreign_office.session_id
10
10
  });
11
11
  window.onbeforeunload = function (e) {
12
- debug_logger.log("about to unload page")
12
+ debug_logger.log("about to unload page", 1, 'foreign-office')
13
13
  pubnubbus.unsubscribe()
14
14
  };
15
15
  this.pubnub.addListener({
@@ -17,8 +17,8 @@ var PubnubBus = Class.extend({
17
17
  foreign_office.handleMessage(m)
18
18
  },
19
19
  status: function(s){
20
- debug_logger.log("Foreign Office PubnubBus:")
21
- debug_logger.log(s)
20
+ debug_logger.log("Foreign Office PubnubBus:", 1, 'foreign-office')
21
+ debug_logger.log(s, 1, 'foreign-office')
22
22
  if( s.operation === 'PNUnsubscribeOperation' ||
23
23
  s.operation === 'PNSubscribeOperation'){return}
24
24
 
@@ -26,28 +26,28 @@ var PubnubBus = Class.extend({
26
26
  s.category === 'PNUnexpectedDisconnectCategory' ||
27
27
  s.category === 'PNNetworkIssuesCategory' ||
28
28
  s.category === 'PNNetworkDownCategory'){
29
- debug_logger.log("Network disconnected.")
30
- foreign_office.disconnection(); debug_logger.log('Lost connection to: '); debug_logger.log(subscription.channel)
29
+ debug_logger.log("Network disconnected.", 1, 'foreign-office')
30
+ foreign_office.disconnection(); debug_logger.log('Lost connection to: ', 1, 'foreign-office'); debug_logger.log(subscription.channel, 1, 'foreign-office')
31
31
  }
32
32
  if( s.category === 'PNReconnectedCategory' ||
33
33
  s.category === 'PNNetworkUpCategory'){
34
- foreign_office.reconnection(); debug_logger.log('Reestablished connection to: '); debug_logger.log(subscription.channel)
34
+ foreign_office.reconnection(); debug_logger.log('Reestablished connection to: ', 1, 'foreign-office'); debug_logger.log(subscription.channel, 1, 'foreign-office')
35
35
  }
36
36
  if(s.category === 'PNConnectedCategory'){
37
- foreign_office.connect(); debug_logger.log("Connected to: "); debug_logger.log(subscription.channel)
37
+ foreign_office.connect(); debug_logger.log("Connected to: ", 1, 'foreign-office'); debug_logger.log(subscription.channel, 1, 'foreign-office')
38
38
  }
39
39
  }
40
40
  });
41
41
  },
42
42
  subscribe: function(subscription){
43
- debug_logger.log("subscribing with PubnubBus")
44
- debug_logger.log(subscription)
43
+ debug_logger.log("subscribing with PubnubBus", 1, 'foreign-office')
44
+ debug_logger.log(subscription, 1, 'foreign-office')
45
45
  this.pubnub.subscribe({
46
46
  channels : [subscription.channel]
47
47
  });
48
48
  },
49
49
  unsubscribe: function(){
50
- debug_logger.log("unsubscribing all pubnub channels")
50
+ debug_logger.log("unsubscribing all pubnub channels", 1, 'foreign-office')
51
51
  this.pubnub.unsubscribeAll();
52
52
  }
53
53
  })
@@ -1,3 +1,3 @@
1
1
  module ForeignOffice
2
- VERSION = "0.15.10"
2
+ VERSION = "0.15.11"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreign_office
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.10
4
+ version: 0.15.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Draut
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-11-07 00:00:00.000000000 Z
12
+ date: 2018-01-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -129,8 +129,6 @@ files:
129
129
  - test/dummy/config/locales/en.yml
130
130
  - test/dummy/config/routes.rb
131
131
  - test/dummy/config/secrets.yml
132
- - test/dummy/db/test.sqlite3
133
- - test/dummy/log/test.log
134
132
  - test/dummy/public/404.html
135
133
  - test/dummy/public/422.html
136
134
  - test/dummy/public/500.html
@@ -157,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
157
155
  version: '0'
158
156
  requirements: []
159
157
  rubyforge_project:
160
- rubygems_version: 2.6.12
158
+ rubygems_version: 2.6.13
161
159
  signing_key:
162
160
  specification_version: 4
163
161
  summary: A light framework that provides functionality for listeners on web clients
@@ -191,8 +189,6 @@ test_files:
191
189
  - test/dummy/config/routes.rb
192
190
  - test/dummy/config/secrets.yml
193
191
  - test/dummy/config.ru
194
- - test/dummy/db/test.sqlite3
195
- - test/dummy/log/test.log
196
192
  - test/dummy/public/404.html
197
193
  - test/dummy/public/422.html
198
194
  - test/dummy/public/500.html
File without changes
@@ -1,33 +0,0 @@
1
- ForeignOffice.publish: {:channel=>"TestMe", :object=>{:this=>"is a test"}}
2
- ForeignOffice.publish: {:channel=>"TestMe", :object=>{:this=>"is another test"}}
3
- ForeignOffice.publish: {:channel=>"TestMe", :object=>{:this=>"is a test"}}
4
- ForeignOffice.publish: {:channel=>"TestMeAgain", :object=>{:this=>"is another test"}}
5
- ForeignOffice.publish: {:channel=>"TestMe", :object=>{:this=>"is a test"}}
6
- ForeignOffice.publish: {:channel=>"TestMeAgain", :object=>{:this=>"is another test"}}
7
- ForeignOffice#publish! attempt: 1 message: {:channel=>"TestMe", :object=>{:this=>"is a test"}}
8
- ForeignOffice#publish! attempt: 1 message: {:channel=>"TestMeAgain", :object=>{:this=>"is another test"}}
9
- ForeignOffice.publish: {:channel=>"TestMe", :object=>{:this=>"is a test"}}
10
- ForeignOffice#publish! attempt: 1 message: {:channel=>"TestMe", :object=>{:this=>"is a test"}}
11
- ForeignOffice.publish: {:channel=>"TestMe", :object=>{:this=>"is a test"}}
12
- ForeignOffice.publish: {:channel=>"TestMe", :object=>{:this=>"is a test"}}
13
- ForeignOffice.publish: {:channel=>"TestMe", :object=>{:this=>"is a test"}}
14
- ForeignOffice.publish: {:channel=>"TestMeAgain", :object=>{:this=>"is another test"}}
15
- ForeignOffice.publish: {:channel=>"TestMe", :object=>{:this=>"is a test"}}
16
- ForeignOffice.publish: {:channel=>"TestMe", :object=>{:this=>"is another test"}}
17
- ForeignOffice.publish: {:channel=>"TestMe", :object=>{:this=>"is a test"}}
18
- ForeignOffice.publish: {:channel=>"TestMeAgain", :object=>{:this=>"is another test"}}
19
- ForeignOffice#publish! attempt: 1 message: {:channel=>"TestMe", :object=>{:this=>"is a test"}}
20
- ForeignOffice#publish! attempt: 1 message: {:channel=>"TestMeAgain", :object=>{:this=>"is another test"}}
21
- ForeignOffice.publish: {:channel=>"TestMe", :object=>{:this=>"is a test"}}
22
- ForeignOffice#publish! attempt: 1 message: {:channel=>"TestMe", :object=>{:this=>"is a test"}}
23
- ForeignOffice.publish: {:channel=>"TestMe", :object=>{:this=>"is a test"}}
24
- ForeignOffice#publish! attempt: 1 message: {:channel=>"TestMe", :object=>{:this=>"is a test"}}
25
- ForeignOffice.publish: {:channel=>"TestMe", :object=>{:this=>"is a test"}}
26
- ForeignOffice.publish: {:channel=>"TestMe", :object=>{:this=>"is a test"}}
27
- ForeignOffice.publish: {:channel=>"TestMeAgain", :object=>{:this=>"is another test"}}
28
- ForeignOffice.publish: {:channel=>"TestMe", :object=>{:this=>"is a test"}}
29
- ForeignOffice.publish: {:channel=>"TestMe", :object=>{:this=>"is another test"}}
30
- ForeignOffice.publish: {:channel=>"TestMe", :object=>{:this=>"is a test"}}
31
- ForeignOffice.publish: {:channel=>"TestMeAgain", :object=>{:this=>"is another test"}}
32
- ForeignOffice#publish! attempt: 1 message: {:channel=>"TestMe", :object=>{:this=>"is a test"}}
33
- ForeignOffice#publish! attempt: 1 message: {:channel=>"TestMeAgain", :object=>{:this=>"is another test"}}