com.wallstop-studios.dxmessaging 2.0.0-rc13 → 2.0.0-rc14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -221,11 +221,15 @@
221
221
  );
222
222
  if (!_globalSinks.TryGetValue(messageHandler, out count))
223
223
  {
224
- MessagingDebug.Log(
225
- LogLevel.Error,
226
- "Received over-deregistration of GlobalAcceptAll for MessageHandler {0}. Check to make sure you're not calling (de)registration multiple times.",
227
- messageHandler
228
- );
224
+ if (MessagingDebug.enabled)
225
+ {
226
+ MessagingDebug.Log(
227
+ LogLevel.Error,
228
+ "Received over-deregistration of GlobalAcceptAll for MessageHandler {0}. Check to make sure you're not calling (de)registration multiple times.",
229
+ messageHandler
230
+ );
231
+ }
232
+
229
233
  return;
230
234
  }
231
235
 
@@ -421,7 +425,7 @@
421
425
  _uniqueInterceptorsAndPriorities.Remove(interceptor);
422
426
  }
423
427
  }
424
- else
428
+ else if (MessagingDebug.enabled)
425
429
  {
426
430
  MessagingDebug.Log(
427
431
  LogLevel.Error,
@@ -441,7 +445,7 @@
441
445
  complete = interceptors.Remove(interceptor);
442
446
  }
443
447
 
444
- if (!complete)
448
+ if (!complete && MessagingDebug.enabled)
445
449
  {
446
450
  MessagingDebug.Log(
447
451
  LogLevel.Error,
@@ -534,7 +538,7 @@
534
538
  }
535
539
  }
536
540
 
537
- if (!foundAnyHandlers)
541
+ if (!foundAnyHandlers && MessagingDebug.enabled)
538
542
  {
539
543
  MessagingDebug.Log(
540
544
  LogLevel.Info,
@@ -765,7 +769,7 @@
765
769
  }
766
770
  }
767
771
 
768
- if (!foundAnyHandlers)
772
+ if (!foundAnyHandlers && MessagingDebug.enabled)
769
773
  {
770
774
  MessagingDebug.Log(
771
775
  LogLevel.Info,
@@ -1096,7 +1100,7 @@
1096
1100
  }
1097
1101
  }
1098
1102
 
1099
- if (!foundAnyHandlers)
1103
+ if (!foundAnyHandlers && MessagingDebug.enabled)
1100
1104
  {
1101
1105
  MessagingDebug.Log(
1102
1106
  LogLevel.Info,
@@ -1914,12 +1918,16 @@
1914
1918
  || !handler.TryGetValue(messageHandler, out count)
1915
1919
  )
1916
1920
  {
1917
- MessagingDebug.Log(
1918
- LogLevel.Error,
1919
- "Received over-deregistration of {0} for {1}. Check to make sure you're not calling (de)registration multiple times.",
1920
- type,
1921
- messageHandler
1922
- );
1921
+ if (MessagingDebug.enabled)
1922
+ {
1923
+ MessagingDebug.Log(
1924
+ LogLevel.Error,
1925
+ "Received over-deregistration of {0} for {1}. Check to make sure you're not calling (de)registration multiple times.",
1926
+ type,
1927
+ messageHandler
1928
+ );
1929
+ }
1930
+
1923
1931
  return;
1924
1932
  }
1925
1933
 
@@ -1937,7 +1945,7 @@
1937
1945
  _ = sinks.Remove(type);
1938
1946
  }
1939
1947
 
1940
- if (!complete)
1948
+ if (!complete && MessagingDebug.enabled)
1941
1949
  {
1942
1950
  MessagingDebug.Log(
1943
1951
  LogLevel.Error,
@@ -2032,12 +2040,16 @@
2032
2040
  || !handler.TryGetValue(messageHandler, out count)
2033
2041
  )
2034
2042
  {
2035
- MessagingDebug.Log(
2036
- LogLevel.Error,
2037
- "Received over-deregistration of {0} for {1}. Check to make sure you're not calling (de)registration multiple times.",
2038
- type,
2039
- messageHandler
2040
- );
2043
+ if (MessagingDebug.enabled)
2044
+ {
2045
+ MessagingDebug.Log(
2046
+ LogLevel.Error,
2047
+ "Received over-deregistration of {0} for {1}. Check to make sure you're not calling (de)registration multiple times.",
2048
+ type,
2049
+ messageHandler
2050
+ );
2051
+ }
2052
+
2041
2053
  return;
2042
2054
  }
2043
2055
 
@@ -2059,7 +2071,7 @@
2059
2071
  _ = sinks.Remove(type);
2060
2072
  }
2061
2073
 
2062
- if (!complete)
2074
+ if (!complete && MessagingDebug.enabled)
2063
2075
  {
2064
2076
  MessagingDebug.Log(
2065
2077
  LogLevel.Error,
@@ -18,6 +18,8 @@
18
18
  /// </summary>
19
19
  public static class MessagingDebug
20
20
  {
21
+ public static bool enabled = false;
22
+
21
23
  /// <summary>
22
24
  /// Custom log function to use.
23
25
  /// </summary>
@@ -47,6 +49,11 @@
47
49
  /// <param name="args">Args to populate format string with.</param>
48
50
  public static void Log(LogLevel logLevel, string message, params object[] args)
49
51
  {
52
+ if (!enabled)
53
+ {
54
+ return;
55
+ }
56
+
50
57
  Action<LogLevel, string> logFunction = LogFunction;
51
58
  /*
52
59
  We can potentially avoid an unnecessary string.Format call if the LogFunction is null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "com.wallstop-studios.dxmessaging",
3
- "version": "2.0.0-rc13",
3
+ "version": "2.0.0-rc14",
4
4
  "displayName": "DxMessaging",
5
5
  "description": "Synchronous Event Bus for Unity",
6
6
  "unity": "2021.3",