ScarletLib / Scarlet

C# cross-platform robotics library with hardware support for Raspberry Pi and BeagleBone Black.
https://github.com/huskyroboticsteam/Scarlet/wiki
GNU Lesser General Public License v3.0
7 stars 3 forks source link

Add a new logging destination Scarlet.Utilities.Log.WriteDestination.CALLBACK #64

Open ritzow opened 6 years ago

ritzow commented 6 years ago

Add a callback logging destination so log messages can be hooked into something like a user interface element. I guess the callback function would have a parameter that contains all the log message info (severity, message text, time, etc.).

Baldstrom commented 5 years ago

Cai and I talked about this; I can't remember now, but I think we were talking to you also. Anyway, for record keeping I wanted to post here. We think it's a great idea and want to implement it and we also want to clean up the code in the Log.cs file since it's become too disorganized, so we will probably implement this when we go through that process. Thanks for the recommendation!

ritzow commented 5 years ago

When you get around to updating logging destinations, they can be greatly simplified by using only a delegate/callback instead of special types. Utility callbacks such as writing to a file, or to the console, can be added to a utility class in the style of Java's HTTP BodySubscribers class.