当前位置: 首页>>代码示例>>C#>>正文


C# Logger.Close方法代码示例

本文整理汇总了C#中Logger.Close方法的典型用法代码示例。如果您正苦于以下问题:C# Logger.Close方法的具体用法?C# Logger.Close怎么用?C# Logger.Close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Logger的用法示例。


在下文中一共展示了Logger.Close方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SmartCamTest_TestRecordedClipsAccessMethods

        public void SmartCamTest_TestRecordedClipsAccessMethods()
        {
            // this now happens in the constructor of the platform
            //Globals.Initialize();

            using (HomeOS.Hub.Platform.Platform platform = new HomeOS.Hub.Platform.Platform(new[] {"-r", "unittesting"}))
            {
                platform.Start();
                int moduleCount = platform.GetRunningModules().Count;
                Assert.IsTrue(moduleCount == 0);

                // ensure that the test data recorded video files have the write times for our test
                // this is necessary since the time stamp on the data files changes whenever you sync from source control

                Helpers.FixFileTime("..\\..\\Apps\\SmartCam\\Data\\SmartCamApp\\videos\\foscam-157.54.148.65 - foscamdriver2\\2013-2-12\\15-4.mp4", new DateTime(2013, 2, 12, 15, 4, 0, DateTimeKind.Local));
                Helpers.FixFileTime("..\\..\\Apps\\SmartCam\\Data\\SmartCamApp\\videos\\foscam-157.54.148.65 - foscamdriver2\\2013-2-12\\15-5.mp4", new DateTime(2013, 2, 12, 15, 5, 0, DateTimeKind.Local));
                Helpers.FixFileTime("..\\..\\Apps\\SmartCam\\Data\\SmartCamApp\\videos\\foscam-157.54.148.65 - foscamdriver2\\2013-2-12\\15-5_2.mp4", new DateTime(2013, 2, 12, 15, 5, 2, DateTimeKind.Local));
                Helpers.FixFileTime("..\\..\\Apps\\SmartCam\\Data\\SmartCamApp\\videos\\webcam - webcamdriver\\2013-2-12\\15-20.mp4", new DateTime(2013, 2, 12, 15, 20, 0, DateTimeKind.Local));
                Helpers.FixFileTime("..\\..\\Apps\\SmartCam\\Data\\SmartCamApp\\videos\\webcam - webcamdriver\\2013-2-12\\15-21.mp4", new DateTime(2013, 2, 12, 15, 21, 0, DateTimeKind.Local));

                HomeOS.Hub.Apps.SmartCam.SmartCam smartCam = new HomeOS.Hub.Apps.SmartCam.SmartCam();
                Logger logger = new Logger();
                smartCam.Initialize(platform, logger, new ModuleInfo("SmartCamApp", "AppSmartCam", "HomeOS.Hub.Apps.SmartCam", "..\\..\\Apps\\SmartCam\\Data\\SmartCamApp", false), 0);
                smartCam.Start();
                string[] cameraArray = smartCam.GetRecordedCamerasList();

                Assert.IsTrue(cameraArray.Length == 2);
                Assert.IsTrue(cameraArray[0] == "foscam-157.54.148.65 - foscamdriver2");
                Assert.IsTrue(cameraArray[1] == "webcam - webcamdriver");
                Assert.IsTrue(smartCam.GetRecordedClipsCount(cameraArray[0]) == 3);
                Assert.IsTrue(smartCam.GetRecordedClipsCount(cameraArray[1]) == 2);

                string[] clipUrlsArray1 = smartCam.GetRecordedClips(cameraArray[0], 3);
                Assert.IsTrue(clipUrlsArray1.Length == 3);
                Assert.IsTrue(clipUrlsArray1[0] == String.Format("http://{0}:51430/DefaultHomeId/SmartCamApp/videos/foscam-157.54.148.65 - foscamdriver2/2013-2-12/15-5_2.mp4", Helpers.GetLocalHostIpAddress()));
                Assert.IsTrue(clipUrlsArray1[1] == String.Format("http://{0}:51430/DefaultHomeId/SmartCamApp/videos/foscam-157.54.148.65 - foscamdriver2/2013-2-12/15-5.mp4", Helpers.GetLocalHostIpAddress()));
                Assert.IsTrue(clipUrlsArray1[2] == String.Format("http://{0}:51430/DefaultHomeId/SmartCamApp/videos/foscam-157.54.148.65 - foscamdriver2/2013-2-12/15-4.mp4", Helpers.GetLocalHostIpAddress()));

                string[] clipUrlsArray2 = smartCam.GetRecordedClips(cameraArray[0], 2);
                Assert.IsTrue(clipUrlsArray2.Length == 2);
                Assert.IsTrue(clipUrlsArray2[0] == String.Format("http://{0}:51430/DefaultHomeId/SmartCamApp/videos/foscam-157.54.148.65 - foscamdriver2/2013-2-12/15-5_2.mp4", Helpers.GetLocalHostIpAddress()));
                Assert.IsTrue(clipUrlsArray2[1] == String.Format("http://{0}:51430/DefaultHomeId/SmartCamApp/videos/foscam-157.54.148.65 - foscamdriver2/2013-2-12/15-5.mp4", Helpers.GetLocalHostIpAddress()));

                string[] clipUrlsArray3 = smartCam.GetRecordedClips(cameraArray[1], 2);
                Assert.IsTrue(clipUrlsArray3.Length == 2);
                Assert.IsTrue(clipUrlsArray3[0] == String.Format("http://{0}:51430/DefaultHomeId/SmartCamApp/videos/webcam - webcamdriver/2013-2-12/15-21.mp4", Helpers.GetLocalHostIpAddress()));
                Assert.IsTrue(clipUrlsArray3[1] == String.Format("http://{0}:51430/DefaultHomeId/SmartCamApp/videos/webcam - webcamdriver/2013-2-12/15-20.mp4", Helpers.GetLocalHostIpAddress()));

                logger.Close();
                smartCam.Stop();
            }
        }
开发者ID:smosgin,项目名称:labofthings,代码行数:52,代码来源:SmartCamTest.cs

示例2: Main

        static void Main(string[] args)
        {
            Logger Logger = new Logger();
            try
            {
                Settings Settings = new Settings(Logger);
                BLL BLL = new BLL(Settings);

                // Get a list of the observations to be processed, both new ones and previously failed ones
                List<Observation> obxList = BLL.GetObservationList();

                // Process each observation based on whether everything matched up (user and observation type)
                foreach (Observation obx in obxList)
                {
                    if (obx.UserId > 0)
                    {
                        if (obx.TestId > 0)
                        {
                            if (BLL.TestValueIsValid(obx))
                            {
                                BLL.ProcessFullMatchAndGoodValue(obx);
                            }
                            else
                            {
                                BLL.ProcessInvalidTestValue(obx);
                            }
                        }
                        else
                        {
                            BLL.ProcessObservationMismatch(obx);
                        }
                    }
                    else
                    {
                        BLL.ProcessNameMismatch(obx);
                    }
                }
                BLL.UpdateUserScores();
            }
            catch (Exception ex)
            {
                Logger.LogLine("Terminated with an exception, as follows:");
                Logger.LogLine(ex.Message);
                if (ex.InnerException != null)
                {
                    Logger.LogLine("Inner exception:");
                    Logger.LogLine(ex.InnerException.Message);
                }
                Logger.Close();
            }
        }
开发者ID:treilly250,项目名称:HL7Load,代码行数:51,代码来源:Program.cs

示例3: QuickLog

        public static void QuickLog(String fileNameOverride, String lineOne, String lineTwo, String lineThree)
        {
            try
            {
                Logger quickLog = new Logger(fileNameOverride);
                quickLog.WriteLine(lineOne);
                if(! lineTwo.Equals("")) quickLog.WriteLine(lineTwo);
                if(! lineThree.Equals("")) quickLog.WriteLine(lineThree);
                quickLog.Close();
            }
            catch (IOException e)
            {
                Console.WriteLine(e.Message);
                Console.WriteLine(e.StackTrace);
            }

        }         
开发者ID:brianleemcqueen,项目名称:brian.lee.mcqueen,代码行数:17,代码来源:Logger.cs

示例4: Main

        static void Main(string[] args)
        {
            DonerCollection data;
            try
            {
                logger = Logger.CreateLogger(true);
                //Test();
                // string filePath = @"TestData\";
                string filePath = System.Configuration.ConfigurationManager.AppSettings["SpreadSheetLocation"];
                string[] files = Directory.GetFiles(filePath, "*.xls*");
                data = new DonerCollection();
                ReadExcel(files, data);
                //TestMerge();
                //TestLogger();
                //TestFileNames(files);
                //TestDonationQueries();
                data.PrintDoners();
               // TestPrintDonationsOfAaron(data);
                data.ConsolidateDoners();
                data.PrintDoners();
                data.PrintDonationCollectionDates();
                if (reportTypes.Contains("Donors"))
                    CreateReportForDoners(data);

                if (reportTypes.Contains("Monthly"))
                    CreateMonthlyReports(data);
                //TestExcelWriter(ref data);
               
            }
            catch (Exception e)
            {
                logger.WriteError("Exception occurred during execution: \n {0}, {1}", e.Message, e.StackTrace);
            }
            finally
            {
                logger.Close();
            }
        }
开发者ID:swerddogg,项目名称:FinanceAggregation,代码行数:38,代码来源:Program.cs

示例5: PublishActivity

        public void PublishActivity()
        {
            Logger logger = new Logger();

            try
            {
                logger.Initialize("ActivityLog", "ActivityLogs");
                logger.WriteSingleLine("Monitoring start_time :" + ServerMonitor.StartTime.ToString(Logger.TIME_FORMAT) + " end_time :" + ServerMonitor.EndTime.ToString(Logger.TIME_FORMAT));

                Hashtable activityTable = ServerMonitor.GetCompletedClientActivity();
                if (activityTable != null)
                {
                    logger.WriteClientActivities(activityTable, true);
                }

                activityTable = ServerMonitor.GetCurrentClientActivity();
                if (activityTable != null)
                {
                    logger.WriteClientActivities(activityTable, false);
                }
                ServerMonitor.Reset();
            }
            catch (Exception e)
            {
                AppUtil.LogEvent("An error occurred while logging client activity " + e.ToString(), EventLogEntryType.Error);
                throw;
            }
            finally
            {
                logger.Close();
            }
        }
开发者ID:javithalion,项目名称:NCache,代码行数:32,代码来源:CacheServer.cs

示例6: Main


//.........这里部分代码省略.........
            mainLogger.Write("___");
            string[] files = Directory.GetFiles(patchersPath, "*.dll");
            var patchers = new List<Patcher>();
            foreach (var file in files)
            {
                Assembly patcherAssembly;
                try
                {
                    patcherAssembly = Assembly.LoadFrom(file);
                }
                catch (Exception e)
                {
                    mainLogger.Error("Unable to load the patcher " + file + " :");
                    mainLogger.Error(e.ToString());
                    continue;
                }
                Type exttype = typeof (Patcher);
                Type extensiontype = null;
                foreach (var type in patcherAssembly.GetExportedTypes())
                {
                    if (exttype.IsAssignableFrom(type))
                    {
                        extensiontype = type;
                        break;
                    }
                }
                if (extensiontype == null)
                {
                    mainLogger.Error("Failed to load patcher " + file + " (Specified assembly does not implement an Patcher class)");
                    continue;
                }

                // Create and register the extension
                try
                {
                    var patcher = Activator.CreateInstance(extensiontype, new object[0]) as Patcher;
                    if (patcher != null)
                        patchers.Add(patcher);
                }
                catch (Exception e)
                {
                    mainLogger.Error("Unable to instantiate the patcher class " + file + " :");
                    mainLogger.Error(e.ToString());
                }
            }
            if (patchers.Count == 0)
            {
                ErrorExit("There are no patches to apply! Exiting.", 3);
                return;
            }
            foreach (var patcher in patchers)
            {
                mainLogger.KeyInfo("Executing patcher \"" + patcher.Name + "\" (by " + string.Join(",", patcher.Authors) + ")...");
                Logger curLogger = new Logger(Path.Combine(ownFolder, "log_" + patcher.Name + ".txt"), null, (int) (verbosity ? Logger.Level.INFO : Logger.Level.KEYINFO));
                try
                {
                    patcher.Patch(curLogger, csharpDef, null);
                }
                catch (TargetInvocationException e)
                {
                    mainLogger.Error("ERROR : Invoking the Patch method for " + patcher.Name + " resulted in an exception :");
                    mainLogger.Error(e.StackTrace);
                    mainLogger.Error(e.InnerException.StackTrace);
                }
                catch (Exception e)
                {
                    mainLogger.Error("ERROR : An exception occured while trying to invoke the Patch method of " + patcher.Name + " :");
                    mainLogger.Error(e.Message + Environment.NewLine + e.StackTrace);
                }
                curLogger.Close();
                mainLogger.Info("Writing the current Assembly-CSharp.dll to a MemoryStream...");
                var asmCSharpStream = new MemoryStream(csharpFileLen);
                csharpDef.Write(asmCSharpStream);
                mainLogger.Info("Reading the current Assembly-CSharp.dll from the MemoryStream...");
                asmCSharpStream.Seek(0, SeekOrigin.Begin);
                csharpDef = AssemblyDefinition.ReadAssembly(asmCSharpStream, new ReaderParameters {AssemblyResolver = resolver});
                asmCSharpStream.Close();
                csharpModule = csharpDef.Modules[0];
            }
            mainLogger.Write(); mainLogger.Write("___");

            if ((mscorlibDef != null) && (mscorlibDef.Modules.Count > 0))
            {
                csharpModule.Types.Add(new TypeDefinition("", "Deobfuscated", Mono.Cecil. TypeAttributes.Public, csharpDef.MainModule.TypeSystem.Object));
            }
            else
                mainLogger.Error("Unable to create the Deobufscated class!");
            string outputPath = Path.Combine(Path.GetDirectoryName(acsharpSource), Path.GetFileNameWithoutExtension(acsharpSource) + ".deobf.dll");
            mainLogger.KeyInfo ("Saving the new assembly to " + outputPath + " ...");
            try
            {
                csharpDef.Write (outputPath);
            }
            catch (Exception e)
            {
                ErrorExit ("Unable to save the assembly : " + e.Message + Environment.NewLine + e.StackTrace);
            }

            ErrorExit ("Success.", 0);
        }
开发者ID:OxideMod,项目名称:Undead,代码行数:101,代码来源:Deobfuscator.cs

示例7: ProcessMDSFolder

        /// <summary>
        /// Processes all the MDS .zip files in the specified folder and submits
        /// them to the abaqis MDS web service with the specified credentials.
        /// </summary>
        /// <param name="appliationPath">The path to the executable that started the program.</param>
        /// <param name="mdsFolderPath">The path where the MDS files exist.</param>
        /// <param name="accountId">The account ID provided by Providigm for your account.</param>
        /// <param name="accountPassword">The account password provided by Providigm for your account.</param>
        /// <returns>A list of MDS Responses, one for each MDS .zip file in the directory.</returns>
        public static LinkedList<MDSResponse> ProcessMDSFolder(string applicationPath, string mdsFolderPath, string accountId, string accountPassword)
        {
            string kNotifyEmail = ConfigurationManager.AppSettings["WebServiceNotificationEmail"];
            string kMDSPostURL = ConfigurationManager.AppSettings["WebServiceURI"];
            LinkedList<MDSResponse> uploadResults = new LinkedList<MDSResponse>();
            // Grab all the files to be processed.
            string[] files = Directory.GetFiles(mdsFolderPath, "*.zip", SearchOption.TopDirectoryOnly);

            // Set up the headers to be sent to the web service
            NameValueCollection headers = new NameValueCollection();
            headers[kAccountIdHeader] = accountId;
            headers[kAccountPasswordHeader] = accountPassword;

            // Set up the parameters for the call.
            NameValueCollection parameters = new NameValueCollection();
            parameters[kNotifyEmailParamName] = kNotifyEmail;

            Logger log = new Logger(applicationPath);
            FileManager fm = new FileManager(mdsFolderPath);

            foreach (string file in files) {
                if (file.Length > 250) {
                    MDSResponse r = new MDSResponse(file);
                    r.Status = "ERROR";
                    r.Message = string.Format("File name too long to process ({0}), skipping", file);
                    uploadResults.AddLast(r);
                    MessageBox.Show(r.Message, "Processing MDS Files");
                    log.LogEntry(r.ToLogEntry());
                    continue;
                }
                WebResponse response = Upload.PostFile(new Uri(kMDSPostURL), parameters, file, kMDSContentType, kMDSFileParameterName, null, headers);
                StreamReader reader = new StreamReader(response.GetResponseStream());
                string results = reader.ReadToEnd();

                MDSResponse mrsp = new MDSResponse(file, results);
                uploadResults.AddLast(mrsp);
                log.LogEntry(mrsp.ToLogEntry());

                // Finally, archive the file
                if (mrsp.UploadError) {
                    fm.ArchiveErroredFile(file);
                } else {
                    fm.ArchiveProcessedFile(file);
                }
            }

            log.Close();

            return uploadResults;
        }
开发者ID:GitHubAdmin,项目名称:MDSDirectoryUpload,代码行数:59,代码来源:FolderUpload.cs


注:本文中的Logger.Close方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。