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
Where: logToConsole is my custom function that logs to the debug console. CrashAnlyticsTool is an external library, compatible with the logging package and provides a method listenToLogs via an extension. (a real example can be sentry_logging.
Now say that I decided to add a warning emoji (⚠️) to the logs of level SEVER. I can modify logToConsole to add the emoji on the fly before dumping to the console. However, I'm not able to modify the external method CrashAnlyticsTool.listenToLogs.
Using stream.map is one good solution. The problem is that LogRecord is immutable, doesn't have copyWith method, and doesn't have a constructor that exposes all fields.
The proposed change is either:
Adding a copyWith method
Adding a named constructor that accepts time and sequenceNumber as params.
Then the solution for the above will look somthing like
Consider the following use-case
Where:
logToConsole
is my custom function that logs to the debug console.CrashAnlyticsTool
is an external library, compatible with thelogging
package and provides a methodlistenToLogs
via an extension. (a real example can be sentry_logging.Now say that I decided to add a warning emoji (⚠️ ) to the logs of level
SEVER
. I can modifylogToConsole
to add the emoji on the fly before dumping to the console. However, I'm not able to modify the external methodCrashAnlyticsTool.listenToLogs
.Using
stream.map
is one good solution. The problem is thatLogRecord
is immutable, doesn't have copyWith method, and doesn't have a constructor that exposes all fields.The proposed change is either:
copyWith
methodtime
andsequenceNumber
as params.Then the solution for the above will look somthing like
The text was updated successfully, but these errors were encountered: