コード例 #1
0
        /// <summary>
        /// Logs a log object
        /// </summary>
        /// <typeparam name="T">The target type (must be serializable)</typeparam>
        /// <param name="log">The log to store</param>
        public override void Log <T>(Log <T> log)
        {
            string uniqueId      = Guid.NewGuid().ToString("N");
            string logName       = log.LogLevel + CacheItemNamePartSeparator + log.TimeStamp.ToFileTimeUtc() + CacheItemNamePartSeparator + uniqueId;
            string serializedLog = SerializationService.SerializeObject(log);

            CachingService.Cache(logName, log);
        }
コード例 #2
0
        /// <summary>
        /// Logs a log object
        /// </summary>
        /// <typeparam name="T">The target type (must be serializable)</typeparam>
        /// <param name="log">The log to store</param>
        public override void Log <T>(Log <T> log)
        {
            string uniqueId      = Guid.NewGuid().ToString("N");
            string logName       = log.LogLevel + "_" + log.TimeStamp.ToFileTimeUtc() + "_" + uniqueId + LogExtension;
            string serializedLog = SerializationService.SerializeObject(log);

            if (!Directory.Exists(LogPath))
            {
                Directory.CreateDirectory(LogPath);
            }
            File.WriteAllText(LogPath + logName, serializedLog);
        }