@@ -17,17 +17,24 @@ internal struct LogConfiguration
1717 public static class NetworkLog
1818 {
1919 internal static LogConfiguration Config ;
20- private static readonly ContextualLogger k_Log = new ( true ) ;
20+ private static ContextualLogger s_Log = new ( true ) ;
2121
22- internal static void SetNetworkManager ( NetworkManager networkManager )
22+ /// <summary>
23+ /// Configures the NetworkLog for integration tests.
24+ /// </summary>
25+ internal static void ConfigureIntegrationTestLogging ( NetworkManager networkManager , bool enableVerboseDebug = false )
2326 {
24- k_Log . UpdateNetworkManagerContext ( networkManager ) ;
27+ // useCompatibilityMode when verboseDebug is not enabled
28+ s_Log = new ContextualLogger ( networkManager , ! enableVerboseDebug ) ;
29+ // This setting will do nothing if the logger is created with useCompatibilityMode=true
30+ Config . LogNetworkManagerRole = enableVerboseDebug ;
2531 }
32+
2633 /// <summary>
2734 /// Gets the current log level.
2835 /// </summary>
2936 /// <value>The current log level.</value>
30- // [Obsolete("Use the LogLevel directly on the NetworkManager instead")]
37+ // TODO: Work on deprecating this field.
3138 public static LogLevel CurrentLogLevel => NetworkManager . Singleton == null ? LogLevel . Normal : NetworkManager . Singleton . LogLevel ;
3239
3340 // internal logging
@@ -37,27 +44,27 @@ internal static void SetNetworkManager(NetworkManager networkManager)
3744 /// </summary>
3845 /// <param name="message">The message to log</param>
3946 [ HideInCallstack ]
40- public static void LogInfo ( string message ) => k_Log . Info ( new Context ( LogLevel . Normal , message , true ) ) ;
47+ public static void LogInfo ( string message ) => s_Log . Info ( new Context ( LogLevel . Normal , message , true ) ) ;
4148 [ HideInCallstack ]
42- internal static void LogInfo ( Context context ) => k_Log . Info ( context ) ;
49+ internal static void LogInfo ( Context context ) => s_Log . Info ( context ) ;
4350
4451 /// <summary>
4552 /// Locally logs a warning log with Netcode prefixing.
4653 /// </summary>
4754 /// <param name="message">The message to log</param>
4855 [ HideInCallstack ]
49- public static void LogWarning ( string message ) => k_Log . Warning ( new Context ( LogLevel . Error , message , true ) ) ;
56+ public static void LogWarning ( string message ) => s_Log . Warning ( new Context ( LogLevel . Error , message , true ) ) ;
5057 [ HideInCallstack ]
51- internal static void LogWarning ( Context context ) => k_Log . Warning ( context ) ;
58+ internal static void LogWarning ( Context context ) => s_Log . Warning ( context ) ;
5259
5360 /// <summary>
5461 /// Locally logs a error log with Netcode prefixing.
5562 /// </summary>
5663 /// <param name="message">The message to log</param>
5764 [ HideInCallstack ]
58- public static void LogError ( string message ) => k_Log . Error ( new Context ( LogLevel . Error , message , true ) ) ;
65+ public static void LogError ( string message ) => s_Log . Error ( new Context ( LogLevel . Error , message , true ) ) ;
5966 [ HideInCallstack ]
60- internal static void LogError ( Context context ) => k_Log . Error ( context ) ;
67+ internal static void LogError ( Context context ) => s_Log . Error ( context ) ;
6168
6269 // internal static void Log(LogLevel level, object message, Object gameObject) => Logger.Log($"[Netcode] {message} ({(int)level})");
6370
@@ -66,28 +73,28 @@ internal static void SetNetworkManager(NetworkManager networkManager)
6673 /// </summary>
6774 /// <param name="message">The message to log</param>
6875 [ HideInCallstack ]
69- public static void LogInfoServer ( string message ) => k_Log . InfoServer ( new Context ( LogLevel . Normal , message , true ) ) ;
76+ public static void LogInfoServer ( string message ) => s_Log . InfoServer ( new Context ( LogLevel . Normal , message , true ) ) ;
7077
7178 /// <summary>
7279 /// Logs an info log locally and on the session owner if possible.
7380 /// </summary>
7481 /// <param name="message">The message to log</param>
7582 [ HideInCallstack ]
76- public static void LogInfoSessionOwner ( string message ) => k_Log . InfoServer ( new Context ( LogLevel . Normal , message , true ) ) ;
83+ public static void LogInfoSessionOwner ( string message ) => s_Log . InfoServer ( new Context ( LogLevel . Normal , message , true ) ) ;
7784
7885 /// <summary>
7986 /// Logs a warning log locally and on the server if possible.
8087 /// </summary>
8188 /// <param name="message">The message to log</param>
8289 [ HideInCallstack ]
83- public static void LogWarningServer ( string message ) => k_Log . WarningServer ( new Context ( LogLevel . Error , message , true ) ) ;
90+ public static void LogWarningServer ( string message ) => s_Log . WarningServer ( new Context ( LogLevel . Error , message , true ) ) ;
8491
8592 /// <summary>
8693 /// Logs an error log locally and on the server if possible.
8794 /// </summary>
8895 /// <param name="message">The message to log</param>
8996 [ HideInCallstack ]
90- public static void LogErrorServer ( string message ) => k_Log . ErrorServer ( new Context ( LogLevel . Error , message , true ) ) ;
97+ public static void LogErrorServer ( string message ) => s_Log . ErrorServer ( new Context ( LogLevel . Error , message , true ) ) ;
9198
9299 internal static LogType GetMessageLogType ( UnityEngine . LogType engineLogType )
93100 {
0 commit comments