Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Castle Windsor: Best way to log when a component is registered?

I would like to log when a component (interface and implementation) is registered to my container. What is the best way of doing this?

I found the IKernelEvents interface that looks promising but I can't find how to actually use it.

like image 828
George Mauer Avatar asked Jul 22 '09 19:07

George Mauer


1 Answers

Nevermind, found that IKernel implements IKernelEvents

Therefore simply

WindsorContainer.Kernel.ComponentRegistered += (k, h) => _logger.Debug("Registered {0} - {1}/{2}", k, h.ComponentModel.Service.FullName, h.ComponentModel.Implementation.FullName);
like image 50
George Mauer Avatar answered Sep 22 '22 15:09

George Mauer