/// <summary> /// Test all of the logging channel methods /// </summary> /// <param name="sender">the Console Output logging channel</param> /// <param name="args">the event argumetns</param> private void _channel_LoggingEnabled(ILoggingChannel sender, object args) { sender.LogMessage("event string"); sender.LogValuePair("Ticks", DateTime.UtcNow.Ticks.GetHashCode()); foreach (var item in Enum.GetNames(typeof(LoggingLevel))) { var eventString = string.Format("{0} event string", item); LoggingLevel level = (LoggingLevel)Enum.Parse(typeof(LoggingLevel), item); sender.LogMessage(eventString, level); sender.LogValuePair("Logging Level", (int)level, level); } }
public void Process() { //streamRecorder = new StreamRecorder(); //fileRecorder = new FileRecorder(loggingChannel); loggingChannel.LogMessage("About to start the timer", LoggingLevel.Information); timer = ThreadPoolTimer.CreatePeriodicTimer(RecordingTimerHandler, TimeSpan.FromSeconds(recordingTimerIntervalInMinutes)); }
internal IotHubClient(ILoggingChannel loggingChannel) { this.loggingChannel = loggingChannel; if (string.IsNullOrEmpty(deviceConnectionString)) { loggingChannel.LogMessage("Please provide a device connection string", LoggingLevel.Error); } }
internal async Task SendToHub(DeviceTelemetry deviceTelemetry) { try { using (DeviceClient deviceClient = DeviceClient.CreateFromConnectionString(deviceConnectionString, transportType)) { //await deviceClient.OpenAsync(); //await UpdateTwin(deviceClient); await SendTelemetry(deviceClient, deviceTelemetry); } } catch (Exception) { loggingChannel.LogMessage("Exception occured while creating device client", LoggingLevel.Error); } }
private void SendNotificationMessage(string message, EGALoggerMessageType type) { switch (type) { case EGALoggerMessageType.Error: { #if UNITY UnityEngine.Debug.LogError(message); #elif WINDOWS_UWP || WINDOWS_WSA logger.LogMessage(message, LoggingLevel.Error); log.Error(message); GameAnalytics.MessageLogged(message, type); #elif MONO logger.Error(message); #else logger.LogError(message); GameAnalytics.MessageLogged(message, type); #endif } break; case EGALoggerMessageType.Warning: { #if UNITY UnityEngine.Debug.LogWarning(message); #elif WINDOWS_UWP || WINDOWS_WSA logger.LogMessage(message, LoggingLevel.Warning); log.Warn(message); GameAnalytics.MessageLogged(message, type); #elif MONO logger.Warn(message); #else logger.LogWarning(message); GameAnalytics.MessageLogged(message, type); #endif } break; case EGALoggerMessageType.Debug: { #if UNITY UnityEngine.Debug.Log(message); #elif WINDOWS_UWP || WINDOWS_WSA logger.LogMessage(message, LoggingLevel.Information); log.Debug(message); GameAnalytics.MessageLogged(message, type); #elif MONO logger.Debug(message); #else logger.LogDebug(message); GameAnalytics.MessageLogged(message, type); #endif } break; case EGALoggerMessageType.Info: { #if UNITY UnityEngine.Debug.Log(message); #elif WINDOWS_UWP || WINDOWS_WSA logger.LogMessage(message, LoggingLevel.Information); log.Info(message); GameAnalytics.MessageLogged(message, type); #elif MONO logger.Info(message); #else logger.LogInformation(message); GameAnalytics.MessageLogged(message, type); #endif } break; } }
//ToDo-Make it public via an interface internal async Task <bool> Record() { if (isRecording) { loggingChannel.LogMessage("\nCurrent recording is not yet finished,so skip this cycle"); NumberOfMissedRecordings++; return(isRecording); } DateTime currentDate = DateTime.UtcNow; var audioFileName = AudioFilePrefix + "_" + currentDate.ToString("yyyyMMddHHmmssfff") + ".m4a"; try { //FindCodecsOnThisDevice();//ToDo-enable in debug var stopwatch = Stopwatch.StartNew(); loggingChannel.LogMessage("\nStarted audio recording"); var audioFile = await KnownFolders.VideosLibrary.CreateFileAsync(audioFileName, CreationCollisionOption.GenerateUniqueName); var recordProfileM4a = MediaEncodingProfile.CreateM4a(AudioEncodingQuality.Low); recordProfileM4a.Audio = AudioEncodingProperties.CreatePcm(8000, 1, 16); loggingChannel.LogMessage("\nAudio storage file preparation successful"); await mediaCapture.StartRecordToStorageFileAsync(recordProfileM4a, audioFile); isRecording = true; loggingChannel.LogMessage("\nAudio recording in progress..."); Thread.Sleep(recordingTimeInMilliSeconds); await StopRecording(); stopwatch.Stop(); loggingChannel.LogMessage("Recording logic took " + stopwatch.Elapsed.Seconds.ToString() + " seconds"); SendToIotHub(currentDate, audioFile); return(isRecording); } catch (Exception ex) { loggingChannel.LogMessage("\n" + ex.Message); Cleanup(); return(isRecording); } }