コード例 #1
0
ファイル: App.cs プロジェクト: novaonline/hue-logging
        public async Task Setup()
        {
            Console.Write("This setup requires an API key. Let's get access to the hue bridge button. Are you ready to setup? (y/n): ");
            if (Console.ReadLine().Equals("y"))
            {
                var(IpAddress, Key) = await hueAccess.Setup();

                File.WriteAllText("hue-key.json", Key);
                logger.LogInformation($"Please set environment variable 'HueLogging:ApiKey={Key}' ");
                logger.LogInformation("Your key has been written to hue-key.json in current directory.");
                logger.LogWarning("You'll also need to setup enivronment variable 'HueLogging:Kafka:BootstrapServers'");
            }
            else
            {
                Console.WriteLine("Try command again when you are ready. Bye.");
            }
        }
コード例 #2
0
        public async Task Start(bool shouldStartNewSession)
        {
            try
            {
                await _hueAccess.Setup();

                var precon = await HasPassedPreCondition();

                if (precon)
                {
                    await LogEvent(shouldStartNewSession);
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "Something happened while Logging Hue");
            }
        }