wxLog/wxLogTextCtrl SetTimeStamp
BlitzMax Forums/Brucey's Modules/wxLog/wxLogTextCtrl SetTimeStamp
| ||
I'm baffled! I've looked at the wrapper code and everything.. it all looks OK, but when I try this (in MainFrame.OnInit): Method OnInit()
Super.OnInit()
Local log_textctrl:wxLogTextCtrl = New wxLogTextCtrl.Create(m_connectionlog)
wxLog.SetActiveTarget(log_textctrl)
DebugLog(wxLog.GetTimestamp())
log_textctrl.SetTimestamp("[%I:%M:%S%P] ")
DebugLog(wxLog.GetTimestamp())
wxLogMessage("Log")
wxLogError("Error")
wxLogWarning("Warning")
End MethodThe log messages no longer have a timestamp (the debug message is "%X" and then ""), if I do not call SetTimeStamp, the messages have the default timestamp (which is "%X"). Any ideas? |
| ||
| Okay. Fixed. There were two issues... the first it was never actually setting the text... and the second, once I had sorted that out, after the string went out of scope it would revert to null... haw. While I was fiddling around down there, I also implemented a type called wxLogStream. This takes a TStream as a parameter, and allows you to log out to *any* writeable TStream ;-) (may be handy for some of those hard to reach places). (Yes, I realise that wxWidgets already has a wxLogStream class for logging to C++ streams, but I didn't think it likely anyone would have a C++ stream handle lying around to log to... and it seemed like a good name for the BlitzMax side). Anyway... onto the next problem... |
| ||
| Awesome, I was also looking for a way to log the messages to a file! Thanks. |
| ||
| Is there any way to change the ": " that it inserts between the timestamp and the log message to something else? In my opinion, the 'timestamp' should include the ": ", so that way we have more design options.. |
| ||
| I don't suppose it's possible to have two active targets? (a TextCtrl and a LogStream) EDIT: Sorted this out.. probably should have looked at the code for LogStream a while ago. Code (uses Brucey's appendable stream code): |