Exemplo n.º 1
0
        private void RegisterLogging()
        {
            var configuration = LogConfiguration.FromConfigSection();

            if (configuration == null)
            {
                configuration = new LogConfiguration();
                configuration.Sinks.Add(new TraceSink());
            }

            // Create the kernel.
            var kernel = new LogKernel(configuration);

            // Register the kernel and loggers in the container.
            _kernel.Bind <ILogKernel>().ToConstant(kernel).InSingletonScope();
            _kernel.Bind <ILogger>().ToMethod(x => x.Kernel.Get <ILogKernel>().GetLogger(x.Request.ParentRequest.Service));
        }