Giter Club home page Giter Club logo

metrolog's Introduction

apps

Hi I'm Jean-Marie, a silly mobile cross platform french freelance.

I'm the creator of www.sharpnado.com and like to build open source components.

I'm the founder of "Les Compagnons de l'App", codelapp.fr, which is an app studio gathering very experimented and talented builders.

You can reach me on twitter @Piskariov and on LinkedIn.

My github stats

metrolog's People

Contributors

geektieguy avatar jesperll avatar lprichar avatar mbrit avatar roubachof avatar scottisafool avatar tolgraven avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

metrolog's Issues

Add way to enable IsShakeEnabled without LogController instance

Does it make sense to somehow enable the shake to show the logs without having to instantiate the LogController? Maybe together with the navigation setup it can be a builder.ConfigureMetroLog() call in the generic host builder?

Maybe I should use it in a more real-world scenario but implementing a simple sample it seemed like if I quickly want to enable this functionality without some kind of settings page it doesn't seem to make much sense to create an instance and just set that property.

Do you have any thoughts on that? Was it done like this on purpose?

`NotImplementedException` when using `MetroLog.MicrosoftExtensions` in command line program.

Thanks for MetroLog! With .net7 in Windows 10 I created this simple command line program:

using Microsoft.Extensions.Logging;
using MetroLog.MicrosoftExtensions;

class MetroLogExample
{
    static void Main()
    {
        using var loggerFactory = LoggerFactory.Create(builder =>
        {
            builder.AddTraceLogger(options => { options.MinLevel = LogLevel.Trace; });
        });

        ILogger logger = loggerFactory.CreateLogger<MetroLogExample>();
        logger.LogInformation("I'm done now");
    }
}

I'm setting up the logger this way because my logger instance needs to implement the Microsoft.Extensions.Logging.ILogger interface.
The program successfully writes "I'm done now" to the Visual Studio Debug output but when leaving the Main() method, a System.NotImplementedException is thrown. Relevant logs:

1|2023-03-16T12:26:13.2334363+00:00|TRACE|1|New log manager created
2|2023-03-16T12:26:13.2615268+00:00|TRACE|1|CreateLogger MetroLogExample
3|2023-03-16T12:26:13.2686274+00:00|TRACE|1|Created Logger 'MetroLogExample'
4|2023-03-16T12:26:13.2806980+00:00|INFO|1|MetroLogExample|I'm done now
Exception thrown: 'System.NotImplementedException' in MetroLog.Net6.dll
An unhandled exception of type 'System.NotImplementedException' occurred in MetroLog.Net6.dll
The method or operation is not implemented.

Is this intended behavior/am I doing something wrong/a bug?

Version of MetroLog.Net6: 2.1.0 (via nuget; Date Published: Monday, January 16, 2023 (1/16/2023))

Thank you very much for looking into this.

Shake to show log screen opens multiple times

If you shake fast enough, which is easy to do, the page will get opened multiple times. I noticed this at least on Android and I can imagine, from past experience, that this is something that only happens on Android.

System.NullReferenceException: FileTarget.GetCompressedLogsInternal

Case: Get Compressed Logs in AppCenter Crashes.GetErrorAttachments delegate.

Bug: _logFolder is null when GetCompressedLogsInternal is called before EnsureInitialized is called in FileTargetBase.WriteAsyncCore.

Tested solution proposal: Add EnsureInitialized in FileTargetBase.GetCompressedLogs.

   public async Task<MemoryStream> GetCompressedLogs()
    {
        using (await _lock.LockAsync().ConfigureAwait(false))
        {
            CloseAllOpenStreamsInternal();
            await EnsureInitialized().ConfigureAwait(false);
            return await GetCompressedLogsInternal().ConfigureAwait(false);
        }
    }

Issue with logging to streaming file while in background on iOS

I have a basic Maui iOS geolocation app that also works in the background (all the backgrounding setup is OK).

I'm logging update events every time I get them.
A little while after the app goes into the background, any call to LogInformation results in a Native error. No error if the application is active. That's with either trace, inmemory or streaming.

Not sure what could cause that, but basic Debug.Writeline solves the issue, so it really seems triggered by the use of logging?

Log levels below Information not working

If I change the sample app to eg. use _logger.LogDebug("...") or _logger.LogTrace("...") in RandomLogs method it does not log anything to the different loggers. They have options.MinLevel = LogLevel.Trace;, so seems like a bug.

`AddDebugLogger` doesn't output to Application Output

As discussed in private!

When adding

builder.Logging
            .AddDebugLogger(_ => {});

And then calling a log method of any level, e.g.: _logger.LogInformation("OnCounterClicked()");, nothing gets output to the application output.

The sample app works, but probably because we reference the source directly and/or the whole code is then built with the debug configuration.

All other logging targets seem to work fine from what I tried.

How to configure MetroLog in Blazor Hybrid

Discussed in #9

Originally posted by rich25200 November 17, 2022
Hi,

Could you please tell me how to configure MetroLog in Maui Blazor Hybrid?

I have an error as "BeginScope is not supported on MetroLog"..

Thanks

MetroLogPage Shows FontManager Exception

Hey, when i am click on the RefreshCommand, im getting the following error message shown

FontManager|Unable to load font 'sans-serif-medium' from assets. --> Java.Lang.RuntimeException: Font asset not found sans-serif-medium at Java.Interop.JniEnvironment.StaticMethods.CallStaticObjectMethod(JniObjectReference type, JniMethodInfo method, JniArgumentValue* args) in /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Java.Interop/JniEnvironment.g.cs:line 12890 at Java.Interop.JniPeerMembers.JniStaticMethods.InvokeObjectMethod(String encodedMember, JniArgumentValue* parameters) in /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Java.Interop/JniPeerMembers.JniStaticMethods.cs:line 95 at Android.Graphics.Typeface.CreateFromAsset(AssetManager mgr, String path) in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/obj/Release/net6.0/android-33/mcw/Android.Graphics.Typeface.cs:line 613 at Microsoft.Maui.FontManager.LoadTypefaceFromAsset(String fontfamily, Boolean warning) in D:\a\_work\1\s\src\Core\src\Fonts\FontManager.Android.cs:line 122 --- End of managed Java.Lang.RuntimeException stack trace --- java.lang.RuntimeException: Font asset not found sans-serif-medium at android.graphics.Typeface.createFromAsset(Typeface.java:839) at crc640ec207abc449b2ca.ShellFlyoutRecyclerAdapter.n_onBindViewHolder(Native Method) at crc640ec207abc449b2ca.ShellFlyoutRecyclerAdapter.onBindViewHolder(ShellFlyoutRecyclerAdapter.java:57) at androidx.recyclerview.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:7254) ....

I added the specific .ttf but still get this exception shown, any ideas?

Avoid repeated messages in Output window of IDE?

I've noticed when running Debug builds that each enabled logger is sending its output to the Output window in Visual Studio. So you end with double or multiple of the same output e.g. here is the output with both the AddTraceLogger and AddInMemoryLogger configured:

19|2024-04-02T18:16:19.5288469+00:00|TRACE|1|CreateLogger FlyoutMenuViewModel
20|2024-04-02T18:16:19.5308830+00:00|TRACE|1|Created Logger 'FlyoutMenuViewModel'
21|2024-04-02T18:16:19.5320016+00:00|TRACE|1|CreateLogger FlyoutMenuViewModel
22|2024-04-02T18:16:19.5330669+00:00|TRACE|1|Created Logger 'FlyoutMenuViewModel'

This creates extra noise to sort through in the output window. Am I missing something that controls this in the configuration? Or could there be something added to address it?

Here is how I have it configured:

		builder.Logging
			.SetMinimumLevel(LogLevel.Trace) // IMPORTANT: set the overall minimum log level else individual logger filters may not work
#if DEBUG
			.AddTraceLogger(options => // Writes to the Debug output
			{
				options.MinLevel = LogLevel.Trace;
				options.MaxLevel = LogLevel.Critical;
			})
#endif
			.AddInMemoryLogger(options => // Write to memory in support of displaying events in a UI
			{
				options.MaxLines = 1024;
				options.MinLevel = LogLevel.Debug;
				options.MaxLevel = LogLevel.Critical;
			});

Actually looking at this now I see the memory logger MinLevel is supposed to be Debug but the output is still showing Trace messages. Hmm.

MAUI HTTPClient.PostAsync call throws "BeginScope is not supported on MetroLog"

Followed your setup. Calls to ILogger.LogInformation work as expected. I get two inner exceptions from my line of

HttpResponseMessage result = await httpClient .PostAsync($"api/Channels/get_channelgroup", content);

"An error occurred while writing to logger(s). (BeginScope is not supported on MetroLog) (BeginScope is not supported on MetroLog)"

Guidance for Maui Blazor

Would I be able to get some guidance on invoking GoToLogsPageCommand in a blazor hybrid app in Maui.
You have
<Button Text="Show Logs" Grid.Column="1" HorizontalOptions="End" VerticalOptions="Center" Command="{Binding GoToLogsPageCommand}"/>
So I would need the C# version

What about .NET 7?

Maybe I've overseen something and it isn't a problem, or I've forgot something, but what about support for .NET 7?

I'd love to use MetroLog in my MAUI project but it is absolutely necessary for my project to be in .NET 7 and for now I couldn't get MetroLog to work.

If it does work in .NET 7 and you have any idea what might be the problem or else I'd love to hear it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.