You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The above should be implemented in a way that is consistent throughout the codebase and which is easy to include in new log messages. This means exposing an internal logging API that helps us to emit this information.
I’d suggest embedding this information in the logger object — i.e. so that there is a 1-1 correspondence between logger instances and SDK object instances. This could, for example, be achieved by adding a method to ARTInternalLog for creating a new logger from an existing one, given some metadata, e.g. -[ARTInternalLog loggerForObject:(id)object].
Prior art
What I’m suggesting above is based on the way we do logging in the Asset Tracking SDK. When creating a new object, we also create a new InternalLogHandler instance which stores information about the object that created it (example).
Current state
Our existing log messages often include the address of the object that emitted them, but it is done in an ad-hoc fashion (i.e. needing to remember to include "RT: %p" at the start of the message). For example:
ARTLogWarn(self.logger, @"RT:%p connection \"%@\" has reconnected, but resume failed. Reattaching any attached channels", self, message.connectionId);
Background
Many of the log messages emitted by the SDK are emitted by a specific instance of a class.
We would like all such messages to include some generally-useful information about this instance.
Requirements
Each message logged by a class instance should include the following information:
Logging API considerations (falls under #1617)
The above should be implemented in a way that is consistent throughout the codebase and which is easy to include in new log messages. This means exposing an internal logging API that helps us to emit this information.
I’d suggest embedding this information in the logger object — i.e. so that there is a 1-1 correspondence between logger instances and SDK object instances. This could, for example, be achieved by adding a method to
ARTInternalLog
for creating a new logger from an existing one, given some metadata, e.g.-[ARTInternalLog loggerForObject:(id)object]
.Prior art
What I’m suggesting above is based on the way we do logging in the Asset Tracking SDK. When creating a new object, we also create a new
InternalLogHandler
instance which stores information about the object that created it (example).Current state
Our existing log messages often include the address of the object that emitted them, but it is done in an ad-hoc fashion (i.e. needing to remember to include "RT: %p" at the start of the message). For example:
┆Issue is synchronized with this Jira Task by Unito
The text was updated successfully, but these errors were encountered: