コード例 #1
0
 public ObjectCountController(ISimpleJson simpleJson, ISimpleJsonFile simpleJsonFile, ISimpleLogFactory simpleLogFactory, SimpleLogFactory simpleLogFactory2)
 {
     this.ReportAdd();
     _simpleJson        = simpleJson;
     _simpleJsonFile    = simpleJsonFile;
     _simpleLogFactory  = simpleLogFactory;
     _simpleLogFactory2 = simpleLogFactory2;
 }
コード例 #2
0
ファイル: WebApiHelper.cs プロジェクト: congzw/simple-trace
 public WebApiHelper(ISimpleLogFactory simpleLogFactory)
 {
     //todo: refactor code
     //var response = await httpClient.GetAsync(uri).ConfigureAwait(false);
     //var handler = new HttpClientHandler { AutomaticDecompression = DecompressionMethods.GZip };
     //_httpClient = new HttpClient(handler);
     _httpClient = new HttpClient();
     _simpleLog  = simpleLogFactory.CreateLogFor(this);
 }
コード例 #3
0
        static void Main()
        {
            _simpleLogFactory = ExLogInit.SetupLogEx();
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            var servicesToRun = new ServiceBase[]
            {
                new SimpleTraceService()
            };

            ServiceBase.Run(servicesToRun);
        }
コード例 #4
0
        public static ISimpleLogFactory LogWithSimpleEventBus(this ISimpleLogFactory simpleLogFactory)
        {
            var logActions = simpleLogFactory.LogActions;

            logActions.SetActions(SimpleEventBus, true, LogMessage);

            var initLog = simpleLogFactory.CreateLogFor("SimpleEventBusExtensions");

            initLog.LogInfo(">>>> LogWithSimpleEventBus");
            return(simpleLogFactory);
        }
コード例 #5
0
 public static ISimpleLog GetOrCreateLogFor(this ISimpleLogFactory factory, object instance)
 {
     if (instance == null)
     {
         throw new ArgumentNullException(nameof(instance));
     }
     if (instance is Type type)
     {
         return(factory.GetOrCreateLogFor(type));
     }
     return(factory.GetOrCreateLogFor(instance.GetType()));
 }
コード例 #6
0
        public static ISimpleLogFactory LogWithSimpleEventBus(this ISimpleLogFactory simpleLogFactory, ISimpleEventBus <AsyncMessageEvent> simpleEventBus = null)
        {
            simpleEventBus = simpleEventBus ?? SimpleEventBus <AsyncMessageEvent> .Resolve();

            var logActions = simpleLogFactory.LogActions;

            logActions.SetActions("LogWithSimpleEventBus", true, args =>
            {
                if (args?.Message != null)
                {
                    simpleEventBus.Raise(new AsyncMessageEvent(args.Message.ToString()));
                }
            });

            var initLog = simpleLogFactory.CreateLogFor("SimpleEventBusExtensions");

            initLog.LogInfo(">>>> LogWithSimpleEventBus");
            return(simpleLogFactory);
        }
コード例 #7
0
 public static ISimpleLog GetOrCreateLogFor <T>(this ISimpleLogFactory factory)
 {
     return(factory.GetOrCreateLogFor(typeof(T)));
 }
コード例 #8
0
 public static ISimpleLog GetOrCreateLogFor(this ISimpleLogFactory factory, Type type)
 {
     return(factory.GetOrCreate(type.FullName));
 }
コード例 #9
0
 public MyLogFactory(ISimpleLogFactory simpleLogFactory)
 {
     _simpleLogFactory = simpleLogFactory;
 }