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

Refactored logging API to make use of libvlcLogInterop #15

Closed

Conversation

jeremyVignelles
Copy link
Collaborator

@jeremyVignelles jeremyVignelles commented Sep 19, 2018

This new API lets .net user receive logs from callbacks, thanks to https://github.com/jeremyVignelles/libvlcLogInterop .

Things left to do:

  • Test libvlcLogInterop on other platforms.
    • Android
    • iOS
    • macOS
    • windows x86
  • Publish packages for libvlcLogInterop

Tested on :

  • linux x64
  • windows x64

Copy link
Member

@mfkl mfkl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

A few points:

  • videolan.libvlcloginterop naming: I think you should drop the videolan part. I only used it for libvlc native packages, and I'm still wondering whether that was a good idea. If the namespace is there, adding it to the package name might be redundant. What do you think?

  • If I'm correct, right now loaded the logging binary is loaded by default. Any reason why? How about loading it only on demand?

  • Tests: I need to start a contributing guide, but I'm gonna start asking for tests with PRs. What are your thoughts on testing this particular thing?

  • build libvlcloginterop for other platforms: If I believe your build.sh, you currently build successfully the logging module for these platforms:

build x86_64-linux-gnu
build arm-linux-gnueabihf
build x86_64-w64-mingw32
build i686-w64-mingw32
build x86_64-apple-darwin

Anything missing?
Should we upload a nuget with all of these builds so we can test this PR properly? As they depend on each others.

Last but not least: How's the perf?

I might have more feedback when I start testing the code on Android/iOS, but good job :)

LibVLCSharp/Shared/Core.cs Outdated Show resolved Hide resolved
LibVLCSharp/Shared/Core.cs Outdated Show resolved Hide resolved
LibVLCSharp/Shared/LibVLC.cs Outdated Show resolved Hide resolved
LibVLCSharp/Shared/LibVLC.cs Show resolved Hide resolved
LibVLCSharp/Shared/LibVLC.cs Show resolved Hide resolved
LibVLCSharp/Shared/LibVLC.cs Show resolved Hide resolved
LibVLCSharp/Shared/Utf8StringMarshaler.cs Outdated Show resolved Hide resolved
@mfkl mfkl added enhancement New feature or request help wanted Extra attention is needed on review labels Sep 20, 2018
}
}

internal static T GetLibraryFunction<T>(IntPtr libraryHandle, string functionName)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these definitions belong to MarshalUtils

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then PreloadNativeLibrary too.

I think the loading architecture could be done in a separate class if you want, but maybe it's another PR? Maybe that other PR could be done before this one?
I've mixed a few things here, the linux .so loading and the real implementation of the logging API.
I'm just rebasing for now, will see in the future what to do with that.

GetLogContext(logContext, out var module, out var file, out var line);

// Do the notification on another thread, so that VLC is not interrupted by the logging
Task.Run(() => this._logEventHandler?.Invoke(new LogMessage(logLevel, message, module, file, line)));
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spawn a thread with a Blocking queue instead, so we guarantee the order of the log message and don't depend on the ThreadPool's load.

This is the second implementation, rebased on master.
@jeremyVignelles
Copy link
Collaborator Author

videolan.libvlcloginterop naming: I think you should drop the videolan part. I only used it for libvlc native packages, and I'm still wondering whether that was a good idea. If the namespace is there, adding it to the package name might be redundant. What do you think?

Done

If I'm correct, right now loaded the logging binary is loaded by default. Any reason why? How about loading it only on demand?

Right, will be included in a next commit here. I just tried to rebase on master for now.

Tests: I need to start a contributing guide, but I'm gonna start asking for tests with PRs. What are your thoughts on testing this particular thing?

I replaced your tests with the new way of doing

build libvlcloginterop for other platforms: If I believe your build.sh, you currently build successfully the logging module for these platforms:

Yeah, that's a discussion for the repo. I built for some platforms but didn't test all of them. We will probably need to think about it...

Anything missing?

For now :

  • On-demand loading
  • Log dispatcher thread
  • MacOS implementation
  • Android/iOS implementation? is it feasible?

Should we upload a nuget with all of these builds so we can test this PR properly? As they depend on each others.

We need to publish a nuget package before merging, but for now, I'm trying with a beta package I built and put in a local nuget folder on my machine.

Last but not least: How's the perf?

Didn't test yet, but hopefully better than Vlc.DotNet

vlc-mirrorer pushed a commit that referenced this pull request Apr 10, 2019
Remove the current Log API which only (kinda) works on Windows and not other platforms, in preparation of 3.0 stable release. Proper logging mechanism will come back soon with #15
@jeremyVignelles
Copy link
Collaborator Author

This seems to work as expected with #57 , closing this as no longer required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed on review
Projects
None yet
2 participants