-
Notifications
You must be signed in to change notification settings - Fork 165
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
RNET-1161: Implement support for using a log level for a specific log category #3634
Conversation
Pull Request Test Coverage Report for Build 9679342781Details
💛 - Coveralls |
Pull Request Test Coverage Report for Build 9681475484Details
💛 - Coveralls |
Pull Request Test Coverage Report for Build 9715427241Details
💛 - Coveralls |
Pull Request Test Coverage Report for Build 9742115832Details
💛 - Coveralls |
Pull Request Test Coverage Report for Build 9810938552Details
💛 - Coveralls |
Pull Request Test Coverage Report for Build 9894480239Details
💛 - Coveralls |
@@ -223,8 +236,14 @@ private static class NativeMethods | |||
[DllImport(InteropConfig.DLL_NAME, EntryPoint = "shared_realm_refresh_async", CallingConvention = CallingConvention.Cdecl)] | |||
public static extern bool refresh_async(SharedRealmHandle realm, IntPtr tcs_handle, out NativeException ex); | |||
|
|||
[DllImport(InteropConfig.DLL_NAME, EntryPoint = "shared_realm_get_log_level", CallingConvention = CallingConvention.Cdecl)] | |||
public static extern LogLevel get_log_level([MarshalAs(UnmanagedType.LPWStr)] string category_name, IntPtr category_name_len); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we're trying to go with using Realm.Native.StringValue
in wrapper calls when needing to pass strings. Am I correct @nirinchev ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding here was that StringValue
is mainly used for the returned strings (Core -> DotNet), whereas the MarshalAs
is DotNet -> Core primarily?
Description
Deprecates
Logger
in favor of its new base classRealmLogger
(see notes below on avoiding breaking changes).Primarily, enables more control over which category of messages should be logged and at which criticality level, by setting and getting a
LogLevel
for a givenLogCategory
. The hierarchy of categories starts atLogCategory.Realm
.Adds a function logger that accepts a callback that will receive the
LogLevel
,LogCategory
, and the message when invoked.Adds a
RealmLogger.Log()
overload taking a category.Notes on avoiding breaking changes
Would-be breaking changes
Users have been able to provide their own
Logger
subclass via theLogger.Default
set
accessor. Custom loggers need to override and implementLogger.LogImpl()
, and with the addition of log categories in this PR, theLogImpl()
signature would require breaking changes.Solution
Essentially, the previous
Logger
class has been renamedRealmLogger
, and another class calledLogger
now derives fromRealmLogger
, with the only own member being theLogImpl()
with an abstract method identical to before to avoid the breaking change.Fixes #3633
@realm/devdocs
TODO