public FileRecorder(ILoggingChannel loggingChannel) { isRecording = false; InitializeAudioSettings(); this.loggingChannel = loggingChannel; iotHubClient = new IotHubClient(loggingChannel); }
public WindowsLogger() { _channel = new LoggingChannel("BackpackPlannerChannel", null); _session = new LoggingSession("BackpackPlannerSession"); _session.AddLoggingChannel(_channel); }
void OnChannelLoggingEnabled(ILoggingChannel sender, object args) { // This method is called when the channel is informing us of channel-related state changes. // Save new channel state. These values can be used for advanced logging scenarios where, // for example, it's desired to skip blocks of logging code if the channel is not being // consumed by any sessions. isChannelEnabled = sender.Enabled; channelLoggingLevel = sender.Level; }
internal IotHubClient(ILoggingChannel loggingChannel) { this.loggingChannel = loggingChannel; if (string.IsNullOrEmpty(deviceConnectionString)) { loggingChannel.LogMessage("Please provide a device connection string", LoggingLevel.Error); } }
/// <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); } }
private GALogger() { #if DEBUG debugEnabled = true; #endif #if WINDOWS_UWP || WINDOWS_WSA session = new FileLoggingSession("ga-session"); #if WINDOWS_UWP var options = new LoggingChannelOptions(); logger = new LoggingChannel("ga-channel", options); #else logger = new LoggingChannel("ga-channel"); #endif session.AddLoggingChannel(logger); LogManagerFactory.DefaultConfiguration.AddTarget(LogLevel.Trace, LogLevel.Fatal, new StreamingFileTarget()); log = LogManagerFactory.DefaultLogManager.GetLogger <GALogger>(); #elif MONO logger = LogManager.GetCurrentClassLogger(); var config = new LoggingConfiguration(); var consoleTarget = new ColoredConsoleTarget(); config.AddTarget("console", consoleTarget); var fileTarget = new FileTarget(); config.AddTarget("file", fileTarget); consoleTarget.Layout = @"${date:format=HH\:mm\:ss} ${logger} ${message}"; fileTarget.FileName = GADevice.WritablePath + Path.DirectorySeparatorChar + "ga_log.txt"; fileTarget.Layout = "${message}"; var rule1 = new LoggingRule("*", LogLevel.Debug, consoleTarget); config.LoggingRules.Add(rule1); var rule2 = new LoggingRule("*", LogLevel.Debug, fileTarget); config.LoggingRules.Add(rule2); LogManager.Configuration = config; #endif #if WINDOWS_PHONE logger = new ILogger(); #endif }
private void OnLoggingEnabled(ILoggingChannel sender, object args) { // Here, you could note a change in the level or keywords. }
public Processor(ILoggingChannel loggingChannel) { this.loggingChannel = loggingChannel; }
void OnChannelLoggingEnabled(ILoggingChannel sender, object args) { isChannelEnabled = sender.Enabled; channelLoggingLevel = sender.Level; }
public ILoggingChannelEvents(ILoggingChannel This) { this.This = This; }