I want to log certain data . But I want to partition it into certain time slots ( for eg data collected over a period of 20 s is stored as one section and then maybe I could add a marker that represents the end of that particular timeslot ( maybe an asterik “*”)). How do I do it?
There does exist a “timer” tool in C# .net. but am not really sure how to go abt doing it..
Thanks.
Why not just log the timestamp for each entry (e.g. via
DateTime.UtcNow)? Then it can be partitioned later by whatever’s reading the file (LINQ would make this really easy).I don’t think that baking the partitioning into the log file itself is a good idea – it makes it impossible to change your partitioning scheme later, and makes the logging code itself more complex. Post-processing more “raw” data is more flexible and probably simpler.