Log() public method

public Log ( object message ) : void
message object
return void
Esempio n. 1
0
        public static void Shutdown(Assembly assembly)
        {
            var injectableTypes = INJECTABLE_TYPES.ToArray();

            foreach (var type in injectableTypes)
            {
                if (type.Assembly == assembly)
                {
                    INJECTABLE_TYPES.Remove(type);
                }
            }

            var instantiableTypes = INSTANTIABLE_TYPES.Keys.ToArray();

            foreach (var type in instantiableTypes)
            {
                if (type.Assembly == assembly)
                {
                    INSTANTIABLE_TYPES.Remove(type);
                }
            }

            var createdTypes = DEPENDENCIES.Keys.ToArray();

            foreach (var type in createdTypes)
            {
                if (type.Assembly == assembly)
                {
                    UnityLogger.Log($"removing type {type}");
                    var hashSet = DEPENDENCIES[type];
                    hashSet.Clear();
                    DEPENDENCIES.Remove(type);
                }
            }
        }
Esempio n. 2
0
        public void TestLog__MessageNull()
        {
            ArgumentNullException e = Assert.Throws <ArgumentNullException>(delegate
            {
                logger.Log(null);
            });

            Assert.Equal("message", e.ParamName);
        }
Esempio n. 3
0
        public void Log_StartsWithLogPrefix()
        {
            var interceptor = new TestUnityLoggerInterceptor();
            var logger      = new UnityLogger(new SentryOptions {
                DiagnosticLevel = SentryLevel.Debug
            }, interceptor);

            logger.Log(SentryLevel.Debug, "TestLog");

            StringAssert.StartsWith(UnityLogger.LogPrefix, interceptor.LogMessage);
        }
        public void PrintSubscribers()
        {
#if UNITY_EDITOR
            foreach (var entry in m_subscribers)
            {
                if (entry.Value.Count == 0)
                {
                    continue;
                }

                UnityLogger.Log($"Type: {entry.Key}, subscribers: {entry.Value.Count}");
            }
#endif
        }
Esempio n. 5
0
        public void Log_LowerLevelThanInitializationLevel_DisablesLogger(SentryLevel initializationLevel, SentryLevel lowerLevel)
        {
            var interceptor = new TestUnityLoggerInterceptor();
            var logger      = new UnityLogger(new SentryOptions {
                DiagnosticLevel = initializationLevel
            }, interceptor);

            const string expectedLog = "Some log";

            logger.Log(lowerLevel, expectedLog);

            Assert.False(logger.IsEnabled(lowerLevel));
            Assert.False(interceptor.LogMessage.Contains(expectedLog));
        }
        protected override void OnUpdate()
        {
            var connectToServer = GetSingleton <ConnectToServer>();

            EntityManager.DestroyEntity(GetSingletonEntity <ConnectToServer>());

            var network = World.GetExistingSystem <NetworkStreamReceiveSystem>();

            NetworkEndPoint ep = NetworkEndPoint.LoopbackIpv4;

            ep.Port = connectToServer.port;

            network.Connect(ep);
            UnityLogger.Log($"[Client] Connected to server on {ep.Port} port");
        }
Esempio n. 7
0
        public void Log_DebugLevels_Correspond([Values] SentryLevel sentryLevel)
        {
            LogAssert.ignoreFailingMessages = true;

            var interceptor = new TestUnityLoggerInterceptor();
            var logger      = new UnityLogger(new SentryOptions {
                DiagnosticLevel = sentryLevel
            }, interceptor);

            const string expectedLog = "Some log";

            logger.Log(sentryLevel, expectedLog);

            Assert.True(logger.IsEnabled(sentryLevel));
            Assert.True(interceptor.LogMessage.Contains("Sentry"));
            Assert.True(interceptor.LogMessage.Contains(expectedLog));
            Assert.True(interceptor.LogMessage.Contains(sentryLevel.ToString()));
        }
        public void TestLog__Info()
        {
            logger.Log(LogType.Log, "well hi there");

            innerLogger.Received().Log(LogType.Log, "well hi there");
        }