How to trace every method called

You can do this with Unity Interception See this article for a sample. The article uses attributes, but my code sample below use the dependency injection system (coding to an interface) to setup interception. If you want to log MyClass, it goes something like this: Make an interface that contains all methods in MyClass => … Read more

Add Timestamp to Trace.WriteLine()

Via code You can configure the TraceOutputOptions flags enum. var listener = new ConsoleTraceListener() { TraceOutputOptions = TraceOptions.Timestamp | TraceOptions.Callstack }; Trace.Listeners.Add(listener); Trace.TraceInformation(“hello world”); This does not work for Write and WriteLine, you have use the TraceXXX methods. Via app.config This can also be configured in your App.config with a somewhat equivalent and using TraceSource: … Read more

NSNotificationCenter trapping and tracing all NSNotifications

The only solution I got to work was using breakpoints. I added a breakpoint at __CFXNotificationPost_old (CoreFoundation) and bundled that with a Debugger Command po {NSNotification *}($ebp+12). All of this is nicely doable within the Xcode GUI: click on “Run” on the Xcode application menu (top of the screen) select “Debugger” within the Debugger window … Read more

How to PRINT a message from SQL CLR function?

The answer is that you cannot do the equivalent of PRINT ‘Hello World’ from inside a [SqlFunction()]. You can do it however from a [SqlProcedure()] using SqlContext.Pipe.Send(“hello world”) This is consistent with T-SQL, where you would get the error “Invalid use of a side-effecting operator ‘PRINT’ within a function” if you stick a PRINT inside … Read more

How to save websocket frames in Chrome

From Chrome 76 the HAR file now includes WebSocket messages. WebSocket messages in HAR exports The _webSocketMessages property begins with an underscore to indicate that it’s a custom field. … “_webSocketMessages”: [ { “type”: “send”, “time”: 1558730482.5071473, “opcode”: 1, “data”: “Hello, WebSockets!” }, { “type”: “receive”, “time”: 1558730482.5883863, “opcode”: 1, “data”: “Hello, WebSockets!” } ] … Read more

How to get Javascript Function Calls/Trace at Runtime

I can’t think of a great way to intercept all function calls globally to insert logging (though there is a decent workaround in the update section below). Instead, how about only adding logging to functions in a certain namespace that you care about? You can do this with the following setup code: var functionLogger = … Read more