blueberryfields
blueberryfields

Reputation: 50328

Can my library code identify which project is currently accessing it?

I'm writing a logging/debugging library, and it would be useful if the library could dynamically figure out and report on which projects/libraries are calling into it.

Can I identify who is calling a given function in my library (say, if I call Log("blah") from both a web application and a windows system service, can the Log function figure out where it was called from)?

Upvotes: 0

Views: 38

Answers (1)

M.Babcock
M.Babcock

Reputation: 18965

System.Reflection.Assembly.GetCallingAssembly() will tell you which assembly called your logging library.

Upvotes: 2

Related Questions