mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-23 06:25:19 -07:00
Disable logging for wasm release, share logging for Uno
This commit is contained in:
parent
56851f7b8a
commit
6ec5d20fb2
4 changed files with 61 additions and 44 deletions
|
@ -34,6 +34,10 @@ namespace CalculatorApp
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public App()
|
public App()
|
||||||
{
|
{
|
||||||
|
#if HAS_UNO
|
||||||
|
ConfigureFilters(Uno.Extensions.LogExtensionPoint.AmbientLoggerFactory);
|
||||||
|
#endif
|
||||||
|
|
||||||
this.InitializeComponent();
|
this.InitializeComponent();
|
||||||
this.Suspending += OnSuspending;
|
this.Suspending += OnSuspending;
|
||||||
}
|
}
|
||||||
|
@ -91,10 +95,52 @@ namespace CalculatorApp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
#if HAS_UNO
|
||||||
/// Return True if animation is enabled by user setting.
|
static void ConfigureFilters(Microsoft.Extensions.Logging.ILoggerFactory factory)
|
||||||
/// </summary>
|
{
|
||||||
public static bool IsAnimationEnabled()
|
#if DEBUG
|
||||||
|
factory
|
||||||
|
.WithFilter(new Microsoft.Extensions.Logging.FilterLoggerSettings
|
||||||
|
{
|
||||||
|
{ "Uno", LogLevel.Warning },
|
||||||
|
{ "Windows", LogLevel.Warning },
|
||||||
|
|
||||||
|
// Generic Xaml events
|
||||||
|
//{ "Windows.UI.Xaml", LogLevel.Debug },
|
||||||
|
// { "Windows.UI.Xaml.Shapes", LogLevel.Debug },
|
||||||
|
//{ "Windows.UI.Xaml.VisualStateGroup", LogLevel.Debug },
|
||||||
|
//{ "Windows.UI.Xaml.StateTriggerBase", LogLevel.Debug },
|
||||||
|
// { "Windows.UI.Xaml.UIElement", LogLevel.Debug },
|
||||||
|
// { "Windows.UI.Xaml.Setter", LogLevel.Debug },
|
||||||
|
|
||||||
|
// Layouter specific messages
|
||||||
|
// { "Windows.UI.Xaml.Controls", LogLevel.Debug },
|
||||||
|
//{ "Windows.UI.Xaml.Controls.Layouter", LogLevel.Debug },
|
||||||
|
//{ "Windows.UI.Xaml.Controls.Panel", LogLevel.Debug },
|
||||||
|
|
||||||
|
// Binding related messages
|
||||||
|
// { "Windows.UI.Xaml.Data", LogLevel.Debug },
|
||||||
|
// { "Windows.UI.Xamll.Data", LogLevel.Debug },
|
||||||
|
|
||||||
|
// Binder memory references tracking
|
||||||
|
// { "ReferenceHolder", LogLevel.Debug },
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.AddConsole(LogLevel.Trace);
|
||||||
|
#else
|
||||||
|
#if !__WASM__
|
||||||
|
factory
|
||||||
|
.AddConsole(LogLevel.Error);
|
||||||
|
#endifs
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Return True if animation is enabled by user setting.
|
||||||
|
/// </summary>
|
||||||
|
public static bool IsAnimationEnabled()
|
||||||
{
|
{
|
||||||
return m_isAnimationEnabled;
|
return m_isAnimationEnabled;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,13 @@
|
||||||
<Compile Include="Program.cs" />
|
<Compile Include="Program.cs" />
|
||||||
<Content Include="LinkerConfig.xml" />
|
<Content Include="LinkerConfig.xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<WasmShellMonoEnvironment Include="MONO_GC_PARAMS" Value="soft-heap-limit=512m,nursery-size=64m,evacuation-threshold=66,major=marksweep" />
|
||||||
|
<WasmShellMonoEnvironment Include="MONO_LOG_LEVEL" Value="debug" />
|
||||||
|
<WasmShellMonoEnvironment Include="MONO_LOG_MASK" Value="gc" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.1" />
|
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.1" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Filter" Version="1.1.1" />
|
<PackageReference Include="Microsoft.Extensions.Logging.Filter" Version="1.1.1" />
|
||||||
|
|
|
@ -14,45 +14,7 @@ namespace WindowsCalculator.Wasm
|
||||||
{
|
{
|
||||||
Console.WriteLine("Program.Main");
|
Console.WriteLine("Program.Main");
|
||||||
|
|
||||||
ConfigureFilters(LogExtensionPoint.AmbientLoggerFactory);
|
|
||||||
|
|
||||||
Windows.UI.Xaml.Application.Start(_ => _app = new App());
|
Windows.UI.Xaml.Application.Start(_ => _app = new App());
|
||||||
}
|
}
|
||||||
static void ConfigureFilters(ILoggerFactory factory)
|
|
||||||
{
|
|
||||||
#if DEBUG
|
|
||||||
factory
|
|
||||||
.WithFilter(new FilterLoggerSettings
|
|
||||||
{
|
|
||||||
{ "Uno", LogLevel.Warning },
|
|
||||||
{ "Windows", LogLevel.Warning },
|
|
||||||
|
|
||||||
// Generic Xaml events
|
|
||||||
//{ "Windows.UI.Xaml", LogLevel.Debug },
|
|
||||||
// { "Windows.UI.Xaml.Shapes", LogLevel.Debug },
|
|
||||||
//{ "Windows.UI.Xaml.VisualStateGroup", LogLevel.Debug },
|
|
||||||
//{ "Windows.UI.Xaml.StateTriggerBase", LogLevel.Debug },
|
|
||||||
// { "Windows.UI.Xaml.UIElement", LogLevel.Debug },
|
|
||||||
// { "Windows.UI.Xaml.Setter", LogLevel.Debug },
|
|
||||||
|
|
||||||
// Layouter specific messages
|
|
||||||
// { "Windows.UI.Xaml.Controls", LogLevel.Debug },
|
|
||||||
//{ "Windows.UI.Xaml.Controls.Layouter", LogLevel.Debug },
|
|
||||||
//{ "Windows.UI.Xaml.Controls.Panel", LogLevel.Debug },
|
|
||||||
|
|
||||||
// Binding related messages
|
|
||||||
// { "Windows.UI.Xaml.Data", LogLevel.Debug },
|
|
||||||
// { "Windows.UI.Xamll.Data", LogLevel.Debug },
|
|
||||||
|
|
||||||
// Binder memory references tracking
|
|
||||||
// { "ReferenceHolder", LogLevel.Debug },
|
|
||||||
}
|
|
||||||
)
|
|
||||||
.AddConsole(LogLevel.Trace);
|
|
||||||
#else
|
|
||||||
factory
|
|
||||||
.AddConsole(LogLevel.Error);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,7 +191,9 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Uno.UI" Version="1.45.0-dev.1550" />
|
<PackageReference Include="Uno.UI" Version="1.45.0-dev.1550" />
|
||||||
</ItemGroup>
|
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.1" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Logging.Filter" Version="1.1.1" />
|
||||||
|
</ItemGroup>
|
||||||
<ItemGroup Condition=" '$(Platform)' == 'iPhoneSimulator' ">
|
<ItemGroup Condition=" '$(Platform)' == 'iPhoneSimulator' ">
|
||||||
<NativeReference Include="NativeReferences/x86_64/libCalcManager.a">
|
<NativeReference Include="NativeReferences/x86_64/libCalcManager.a">
|
||||||
<Kind>Static</Kind>
|
<Kind>Static</Kind>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue