Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[housekeeping] Automated PR to fix formatting errors #84

Merged
merged 1 commit into from Oct 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions sample/LoggingDemo/ConsoleUtility.cs
Expand Up @@ -9,16 +9,16 @@ public static class ConsoleUtility

public static string Option(string question, params string[] options)
{
if(options == null || options.Length == 0) return UNKNOWN;
if (options == null || options.Length == 0) return UNKNOWN;

WriteLine(question);
for(int i = 1; i <= options.Length; i++)
for (int i = 1; i <= options.Length; i++)
{
WriteLine($"{i}) {options[i-1]}");
WriteLine($"{i}) {options[i - 1]}");
}
WriteLine();
WriteLine("Select the number of the option you wish to choose...");
if(int.TryParse(ReadLine(), out int result) && result <= options.Length)
if (int.TryParse(ReadLine(), out int result) && result <= options.Length)
{
return options[result - 1];
}
Expand Down
6 changes: 3 additions & 3 deletions sample/LoggingDemo/Program.cs
Expand Up @@ -16,11 +16,11 @@ class Program
static void Main(string[] args)
{
var logger = GetLogger();
while(Continue)
while (Continue)
{
Console.Clear();
string message = ConsoleUtility.Question("Enter a test message, or type 'quit' to exit:");
if(message.Equals("quit", StringComparison.OrdinalIgnoreCase))
if (message.Equals("quit", StringComparison.OrdinalIgnoreCase))
{
break;
}
Expand All @@ -32,7 +32,7 @@ static void Main(string[] args)

private static ILogger GetLogger()
{
switch(ConsoleUtility.Option("Which Logger would you like to use?", Generic, LogglySyslog, LogglyHttp, "Quit"))
switch (ConsoleUtility.Option("Which Logger would you like to use?", Generic, LogglySyslog, LogglyHttp, "Quit"))
{
case Generic:
var genOptions = new Options
Expand Down
2 changes: 1 addition & 1 deletion sample/SampleApp/SampleApp/App.xaml.cs
Expand Up @@ -61,7 +61,7 @@ private void OnLoggerUpdated(LoggerType loggerType)
{
Container.Resolve<ILogger>().TrackEvent("Stopping Logger...");
var container = Container.GetContainer();
switch(loggerType)
switch (loggerType)
{
case LoggerType.AppCenter:
AppCenter.Start(Container.Resolve<IAppCenterConfig>().Secret, typeof(Analytics), typeof(Crashes));
Expand Down
Expand Up @@ -61,7 +61,7 @@ public bool Remove(TKey key)
{
var result = _collection.Remove(key);

if(result)
if (result)
{
CollectionChanged(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove));
PropertyChanged(this, new PropertyChangedEventArgs(nameof(Count)));
Expand Down
Expand Up @@ -9,7 +9,7 @@ namespace SampleApp.ViewModels
{
public class AppCenterConfigPageViewModel : ConfigViewModelBase<IAppCenterConfig>
{
public AppCenterConfigPageViewModel(IAppCenterConfig config, IEventAggregator eventAggregator)
public AppCenterConfigPageViewModel(IAppCenterConfig config, IEventAggregator eventAggregator)
: base(config, eventAggregator)
{
LoggerType = Events.LoggerType.AppCenter;
Expand Down
Expand Up @@ -5,7 +5,7 @@ namespace SampleApp.ViewModels
{
public class AppInsightsConfigPageViewModel : ConfigViewModelBase<IAppInsightsConfig>
{
public AppInsightsConfigPageViewModel(IAppInsightsConfig config, IEventAggregator eventAggregator)
public AppInsightsConfigPageViewModel(IAppInsightsConfig config, IEventAggregator eventAggregator)
: base(config, eventAggregator)
{
LoggerType = Events.LoggerType.AppInsights;
Expand Down
Expand Up @@ -8,7 +8,7 @@ namespace SampleApp.ViewModels
{
public class GelfConfigPageViewModel : ConfigViewModelBase<IGelfConfig>
{
public GelfConfigPageViewModel(IGelfConfig config, IEventAggregator eventAggregator)
public GelfConfigPageViewModel(IGelfConfig config, IEventAggregator eventAggregator)
: base(config, eventAggregator)
{
LoggerType = Events.LoggerType.Graylog;
Expand Down
Expand Up @@ -10,7 +10,7 @@ namespace SampleApp.ViewModels
{
public class LogglyConfigPageViewModel : ConfigViewModelBase<ILogglyConfig>
{
public LogglyConfigPageViewModel(ILogglyConfig config, IEventAggregator eventAggregator)
public LogglyConfigPageViewModel(ILogglyConfig config, IEventAggregator eventAggregator)
: base(config, eventAggregator)
{
LoggerType = LoggerType.LogglyHttp;
Expand Down
Expand Up @@ -5,7 +5,7 @@ namespace SampleApp.ViewModels
{
public class SyslogConfigPageViewModel : ConfigViewModelBase<ISyslogConfig>
{
public SyslogConfigPageViewModel(ISyslogConfig config, IEventAggregator eventAggregator)
public SyslogConfigPageViewModel(ISyslogConfig config, IEventAggregator eventAggregator)
: base(config, eventAggregator)
{
LoggerType = Events.LoggerType.Syslog;
Expand Down
16 changes: 8 additions & 8 deletions sample/SampleApp/SampleApp/Views/AppCenterConfigPage.xaml.cs
Expand Up @@ -9,12 +9,12 @@

namespace SampleApp.Views
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class AppCenterConfigPage : ContentPage
{
public AppCenterConfigPage ()
{
InitializeComponent ();
}
}
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class AppCenterConfigPage : ContentPage
{
public AppCenterConfigPage()
{
InitializeComponent();
}
}
}
16 changes: 8 additions & 8 deletions sample/SampleApp/SampleApp/Views/AppInsightsConfigPage.xaml.cs
Expand Up @@ -9,12 +9,12 @@

namespace SampleApp.Views
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class AppInsightsConfigPage : ContentPage
{
public AppInsightsConfigPage ()
{
InitializeComponent ();
}
}
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class AppInsightsConfigPage : ContentPage
{
public AppInsightsConfigPage()
{
InitializeComponent();
}
}
}
16 changes: 8 additions & 8 deletions sample/SampleApp/SampleApp/Views/GelfConfigPage.xaml.cs
Expand Up @@ -9,12 +9,12 @@

namespace SampleApp.Views
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class GelfConfigPage : ContentPage
{
public GelfConfigPage ()
{
InitializeComponent ();
}
}
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class GelfConfigPage : ContentPage
{
public GelfConfigPage()
{
InitializeComponent();
}
}
}
16 changes: 8 additions & 8 deletions sample/SampleApp/SampleApp/Views/LogGeneratorPage.xaml.cs
Expand Up @@ -9,12 +9,12 @@

namespace SampleApp.Views
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class LogGeneratorPage : ContentPage
{
public LogGeneratorPage ()
{
InitializeComponent ();
}
}
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class LogGeneratorPage : ContentPage
{
public LogGeneratorPage()
{
InitializeComponent();
}
}
}
16 changes: 8 additions & 8 deletions sample/SampleApp/SampleApp/Views/LogglyConfigPage.xaml.cs
Expand Up @@ -9,12 +9,12 @@

namespace SampleApp.Views
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class LogglyConfigPage : ContentPage
{
public LogglyConfigPage ()
{
InitializeComponent ();
}
}
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class LogglyConfigPage : ContentPage
{
public LogglyConfigPage()
{
InitializeComponent();
}
}
}
2 changes: 1 addition & 1 deletion sample/SampleApp/SampleApp/Xaml/EmbeddedImageExtension.cs
Expand Up @@ -21,7 +21,7 @@ public ImageSource ProvideValue(IServiceProvider serviceProvider)
return ImageSource.FromStream(() => assembly.GetManifestResourceStream(name));
}

object IMarkupExtension.ProvideValue(IServiceProvider serviceProvider) =>
object IMarkupExtension.ProvideValue(IServiceProvider serviceProvider) =>
ProvideValue(serviceProvider);
}
}
Expand Up @@ -27,7 +27,7 @@ private void LogInternal(object message, IDictionary<string, string> properties)
{
Console.WriteLine(message);

foreach(var prop in properties ?? new Dictionary<string, string>())
foreach (var prop in properties ?? new Dictionary<string, string>())
{
Console.WriteLine($" {prop.Key}: {prop.Value}");
}
Expand Down
Expand Up @@ -7,12 +7,13 @@ public static class DefaultLoggingRegistrationExtensions
{
public static IContainerRegistry UseAggregateLogger(this IContainerRegistry container)
{
return container.RegisterSingleton<AggregateLogger>(c => {
var logger = new AggregateLogger();
var aggregate = (IAggregateLogger)logger;
aggregate.AddLoggers(c.Resolve<IEnumerable<IAggregableLogger>>());
return logger;
})
return container.RegisterSingleton<AggregateLogger>(c =>
{
var logger = new AggregateLogger();
var aggregate = (IAggregateLogger)logger;
aggregate.AddLoggers(c.Resolve<IEnumerable<IAggregableLogger>>());
return logger;
})
.Register<IAggregateLogger>(c => c.Resolve<AggregateLogger>())
.Register<ILogger>(c => c.Resolve<AggregateLogger>())
.Register<IAnalyticsService>(c => c.Resolve<AggregateLogger>())
Expand Down
2 changes: 1 addition & 1 deletion src/Prism.Plugin.Logging.Abstractions/ILoggerExtensions.cs
Expand Up @@ -89,7 +89,7 @@ public static void Warn(this ILogger logger, string message, IDictionary<string,
private static IDictionary<string, string> GetProperties((string key, string message)[] properties)
{
var dict = new Dictionary<string, string>();
foreach(var (key, message) in properties)
foreach (var (key, message) in properties)
{
dict.Add(key, message);
}
Expand Down
10 changes: 5 additions & 5 deletions src/Prism.Plugin.Logging.AppCenter/AppCenterLogger.cs
Expand Up @@ -13,14 +13,14 @@ public class AppCenterLogger : IAggregableLogger
{
private static Assembly StartupAssembly = null;

public static void Init(object assemblyType) =>
public static void Init(object assemblyType) =>
StartupAssembly = assemblyType.GetType().Assembly;

public AppCenterLogger()
{
IsDebug = IsDebugBuild();

if(!IsDebug)
if (!IsDebug)
{
AnalyticsEnabled();
CrashesEnabled();
Expand All @@ -35,7 +35,7 @@ private bool IsDebugBuild()
try
{
var entryAssembly = Assembly.GetEntryAssembly();
if(entryAssembly == null)
if (entryAssembly == null)
{
entryAssembly = StartupAssembly;
}
Expand All @@ -60,7 +60,7 @@ private bool IsDebugBuild()

public virtual void Log(string message, IDictionary<string, string> properties)
{
if(IsDebug || !analyticsEnabled)
if (IsDebug || !analyticsEnabled)
{
DebugLog(message, properties);
return;
Expand Down Expand Up @@ -92,7 +92,7 @@ public virtual void TrackEvent(string name, IDictionary<string, string> properti
private void DebugLog(string message, IDictionary<string, string> properties)
{
Trace.WriteLine(message);
if(properties != null)
if (properties != null)
{
foreach (var prop in properties ?? new Dictionary<string, string>())
{
Expand Down
Expand Up @@ -19,15 +19,15 @@ public static class AppCenterLoggerExtensions
/// <returns>The <see cref="IContainerRegistry"/>.</returns>
public static IContainerRegistry RegisterAppCenterLogger(this IContainerRegistry container, string appSecret = null, params Type[] appCenterServices)
{
if(!AppCenter.Configured)
if (!AppCenter.Configured)
{
var services = new List<Type>
{
typeof(Analytics),
typeof(Crashes)
};

foreach(var service in appCenterServices)
foreach (var service in appCenterServices)
{
if (!services.Contains(service))
services.Add(service);
Expand Down
16 changes: 8 additions & 8 deletions src/Prism.Plugin.Logging.AppInsights/AppInsightsLogger.cs
Expand Up @@ -24,12 +24,12 @@ public class AppInsightsLogger : IAggregableLogger

public AppInsightsLogger(IApplicationInsightsOptions options)
{
if(!IsDebugBuild())
if (!IsDebugBuild())
{
_options = options;
Startup();
}

}

private bool IsDebugBuild()
Expand All @@ -44,7 +44,7 @@ private bool IsDebugBuild()

return IsDebugAssembly(entryAssembly);
}
catch(Exception ex)
catch (Exception ex)
{
Trace.WriteLine(ex);
return false;
Expand Down Expand Up @@ -89,10 +89,10 @@ internal void ConfigureUserTraits()

_telemetry.Context.GlobalProperties["language"] = Thread.CurrentThread.CurrentCulture.Name;
_telemetry.Context.GlobalProperties["user"] = user;
if(_options.UserTraits != null)

if (_options.UserTraits != null)
{
foreach(var trait in _options.UserTraits)
foreach (var trait in _options.UserTraits)
{
_telemetry.Context.GlobalProperties[trait.Key] = trait.Value;
}
Expand Down Expand Up @@ -158,7 +158,7 @@ private void DebugLog(string message, IDictionary<string, string> properties)

public virtual void Log(string message, IDictionary<string, string> properties)
{
if(_telemetry == null)
if (_telemetry == null)
{
DebugLog(message, properties);
return;
Expand All @@ -178,7 +178,7 @@ public virtual void Report(Exception ex, IDictionary<string, string> properties)
_telemetry.TrackException(ex, properties);
}

public virtual void TrackEvent(string name, IDictionary<string, string> properties) =>
public virtual void TrackEvent(string name, IDictionary<string, string> properties) =>
Log(name, properties);
}
}
Expand Up @@ -28,7 +28,7 @@ public static IContainerRegistry RegisterAppInsightsLogger(this IContainerRegist
return RegisterInternal(container, options);
}

public static IContainerRegistry RegisterAppInsightsLogger(this IContainerRegistry container, string instrumentationKey, IDictionary<string, string> userTraits = null) =>
public static IContainerRegistry RegisterAppInsightsLogger(this IContainerRegistry container, string instrumentationKey, IDictionary<string, string> userTraits = null) =>
RegisterInternal(container, new ApplicationInsightsOptions
{
InstrumentationKey = instrumentationKey,
Expand Down
Expand Up @@ -6,7 +6,7 @@ public static class ArrayExtensions
{
public static T[] SubArray<T>(this T[] array, int length)
{
if(length > array.Length)
if (length > array.Length)
length -= length - array.Length;

T[] result = new T[length];
Expand Down