Esempio n. 1
0
        public void DebugFormat(string format, params object[] args)
        {
            if (!IsDebugEnabled)
            {
                return;
            }

            try
            {
                FormatArgs fargs = new FormatArgs(null, format, args);

                if (UseSyncLogging)
                {
                    DoDebugFormat(fargs);
                }
                else
                {
                    ThreadPool.UnsafeQueueUserWorkItem(DoDebugFormat, fargs);
                }
            }
            catch (Exception e)
            {
                _log.ErrorFormat("Could not enqueue debug log write for message \"{0}\" due to exception {1}", string.Format(format, args), e);
            }
        }
Esempio n. 2
0
        internal ExecutionEnvironment(string[] args)
        {
            SourceFunctionThreads = new List <SourceFunctionThread>();
            Sinks        = new List <SinkFunction>();
            TaskAssembly = new TaskAssembly();

            if (args != null && args.Length > 0)
            {
                Dictionary <string, string> dic = FormatArgs.GetArgsDictionary(args);

                if (dic.ContainsKey(FormatArgs.c_c))
                {
                    string cfgPath = dic[FormatArgs.c_c];

                    if (System.IO.File.Exists(cfgPath))
                    {
                        GlobalConfig.ChangeConfig(cfgPath);
                    }
                }

                TaskAssembly.CheckArgsTaskFile(dic);
            }

            Start();
        }
Esempio n. 3
0
        internal void DoErrorFormat(object state)
        {
            FormatArgs args = state as FormatArgs;

            if (args != null)
            {
                if (args.Provider != null)
                {
                    _log.ErrorFormat(args.Provider, args.Format, args.Args);
                }
                else
                {
                    _log.ErrorFormat(args.Format, args.Args);
                }
            }
        }
Esempio n. 4
0
        public void InfoFormat(string format, params object[] args)
        {
            if (!IsInfoEnabled)
            {
                return;
            }
            FormatArgs fargs = new FormatArgs(null, format, args);

            if (UseSyncLogging)
            {
                DoInfoFormat(fargs);
            }
            else
            {
                ThreadPool.UnsafeQueueUserWorkItem(DoInfoFormat, fargs);
            }
        }
Esempio n. 5
0
        public void ErrorFormat(IFormatProvider provider, string format, params object[] args)
        {
            if (!IsErrorEnabled)
            {
                return;
            }

            FormatArgs fargs = new FormatArgs(provider, format, args);

            if (UseSyncLogging)
            {
                DoErrorFormat(fargs);
            }
            else
            {
                ThreadPool.UnsafeQueueUserWorkItem(DoErrorFormat, fargs);
            }
        }
Esempio n. 6
0
        public void ExcuteMain(string[] args)
        {
            Dictionary <string, string> argsDic = FormatArgs.GetArgsDictionary(args);

            CheckArgsTaskFile(argsDic);

            foreach (KeyValuePair <string, Assembly> kv in TaskAssemblys)
            {
                try
                {
                    if (kv.Value.EntryPoint != null)
                    {
                        kv.Value.EntryPoint.Invoke(null, new object[] { args });
                    }
                }
                catch (Exception ex)
                {
                    Logger.Log.Error(true, "TaskAssembly:", ex);
                }
            }
        }