Пример #1
0
        /// <summary>
        /// Logs to the proper log file specified by the type of LogObject passed.
        /// </summary>
        /// <param name="logobj"></param>
        public void Log(LogObject logobj)
        {
            string typePath  = GetLogType(logobj);
            string LogOutput = string.Concat(GetTimestamp(), " | ", logobj.Log, '\n');

            using (StreamWriter w = File.AppendText(typePath))
            {
                w.WriteLine(LogOutput);
            }
        }
Пример #2
0
        /// <summary>
        /// Returns the path for the file of the specified LogObject type
        /// </summary>
        /// <param name="logobj"></param>
        /// <returns></returns>
        private string GetLogType(LogObject logobj)
        {
            switch (logobj.LogType)
            {
            case "E": return(EventLogPath);

            case "T": return(TransactionLogPath);

            default: return(null);
            }
        }