public LoggingAttribute(AopTypes aopType, LoggingType loggingType, string message, params object[] args) : base(aopType) { m_loggingType = loggingType; m_message = message; m_args = args; }
public YuiMinifier(LoggingType loggingType, bool obfuscateJavaScript, bool preserveAllSemicolons, bool disableOptimizations, bool ignoreEval) { compressor = new JavaScriptCompressor { LoggingType = loggingType, ObfuscateJavascript = obfuscateJavaScript, PreserveAllSemicolons = preserveAllSemicolons, DisableOptimizations = disableOptimizations, IgnoreEval = ignoreEval }; }
public static void AddLogEvent(LoggingType logType, LogEventHandler e) { if (_logEvents == null) { _logEvents = new RealDictionary(); } if (!_logEvents.ContainsKey(logType)) { _logEvents.Add(logType, new List<LogEventHandler>()); } ((List<LogEventHandler>)_logEvents[logType]).Add(e); }
public static void Log(LoggingType logType, string message, object[] args) { if (_logEvents != null) { if (_logEvents.ContainsKey(logType)) { foreach (LogEventHandler e in ((List<LogEventHandler>)_logEvents[logType])) { e.Invoke(logType, message, args); } } } }
public YuiMinifier(LoggingType loggingType, bool obfuscateJavaScript, bool preserveAllSemicolons, bool disableOptimizations, bool ignoreEval, int lineBreakPosition, Encoding encoding, CultureInfo cultureInfo) { compressor = new JavaScriptCompressor { LoggingType = loggingType, ObfuscateJavascript = obfuscateJavaScript, PreserveAllSemicolons = preserveAllSemicolons, DisableOptimizations = disableOptimizations, LineBreakPosition = lineBreakPosition, Encoding = encoding, ThreadCulture = cultureInfo, IgnoreEval = ignoreEval }; }
public static void LogMessage(string message, LoggingType loggingType) { switch (loggingType) { case LoggingType.Both: LogToBoth(message); break; case LoggingType.File: LogToFile(message); break; case LoggingType.Screen: LogToScreen(message); break; } }
private ICollection <LatencyDetectionContext> MoveBacklogDataToReport(LoggingType type) { IDictionary <string, LatencyDetectionLocation> locations = this.thresholdCollection.Locations; int count = locations.Count; List <LatencyDetectionContext> list = null; foreach (KeyValuePair <string, LatencyDetectionLocation> keyValuePair in locations) { BackLog backLog = keyValuePair.Value.GetBackLog(type); if (list == null) { list = new List <LatencyDetectionContext>(count * backLog.Count); } backLog.MoveToList(list); } return(list); }
/// <summary> /// 设置权限操作日志 /// </summary> /// <param name="accountId"></param> /// <param name="accountName"></param> /// <param name="subject"></param> /// <param name="type"></param> /// <param name="permissionId"></param> /// <param name="apiAddress"></param> /// <param name="request"></param> /// <param name="response"></param> /// <param name="ip"></param> public void SetOperate(long accountId, string accountName, string subject, LoggingType type, long?permissionId, string apiAddress, string request, string ip, string response) { this.AccountId = accountId; this.AccountName = accountName; this.Subject = subject; this.Type = (uint)type; this.ApiAddress = apiAddress; this.ApiRequest = request; this.PermissionId = permissionId; if (!string.IsNullOrEmpty(response)) { this.ApiResponse = response; } if (!string.IsNullOrEmpty(ip)) { this.ClientIp = ip; } }
public void SetLogger(ILatencyDetectionLogger logger) { if (logger == null) { throw new ArgumentNullException("logger"); } LoggingType type = logger.Type; if (this.loggers.ContainsKey(type)) { throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, "Can't set logger, because one is already set. You must first call RemoveLogger({0}.{1}).", new object[] { typeof(LoggingType), type })); } this.loggers.Add(type, logger); }
internal void Log(LatencyDetectionContext context) { foreach (KeyValuePair <LoggingType, ILatencyDetectionLogger> keyValuePair in this.loggers) { ILatencyDetectionLogger value = keyValuePair.Value; LoggingType key = keyValuePair.Key; LatencyDetectionContext latencyDetectionContext; LatencyReportingThreshold threshold; ICollection <LatencyDetectionContext> backlog; bool flag = this.checker.ShouldCreateReport(context, key, out latencyDetectionContext, out threshold, out backlog); if (flag) { LatencyDetectionException exception = latencyDetectionContext.CreateLatencyDetectionException(); PerformanceReporter.LogData state = new PerformanceReporter.LogData(value, threshold, latencyDetectionContext, backlog, exception); ThreadPool.QueueUserWorkItem(PerformanceReporter.LogReportDelegate, state); } } }
public void Log(LoggingType type, string mesage) { var prefix = string.Empty; switch (type) { case LoggingType.Error: prefix = "[ERROR]"; break; case LoggingType.Info: prefix = "[Info]"; break; case LoggingType.Warning: prefix = "[Warning]"; break; } Console.WriteLine(prefix + " " + mesage); }
public void WriteLog(string msg, LoggingType type) { if (!Directory.Exists(_logFolderPath)) { Directory.CreateDirectory(_logFolderPath); } if (!File.Exists(_logPath)) { string logStart = "---Installer log from [DATE], [TIME]---\r"; logStart = logStart.Replace("[DATE]", GetDate()); logStart = logStart.Replace("[TIME]", GetTime()); File.WriteAllText(_logPath, logStart); } StringBuilder logBuilder = new StringBuilder(LoggingTypeToString(type)); File.AppendAllText(_logPath, logBuilder.ToString()); Console.WriteLine(string.Format("({0}) {1}", "log_installer", logBuilder.ToString().Replace("\r", ""))); }
/// <summary> /// Write an entry in to the log file /// </summary> /// <param name="logData">Entry into the log file</param> /// <param name="logType">Type of the log entry</param> public void Log(string logData, LoggingType logType = LoggingType.Info) { if (string.IsNullOrEmpty(_LogPath) || string.IsNullOrEmpty(_LogName)) { throw new Exception("Path and/or name for log file not set"); } string logDataPrefix = logType.ToString() + "::"; string timeStamp = DateTime.Now.ToString() + " - "; string formattedLogLine = $"{(!TimeStamp ? "" : timeStamp)}{logDataPrefix + logData}"; List <string> logLine = new List <string> { formattedLogLine }; string dateStamp = "." + DateTime.Now.ToString("yyyyMMdd"); string fileName = $"{_LogName}{(!DateStamp ? "" : dateStamp)}.log"; File.AppendAllLines(_LogPath + fileName, logLine); }
internal static void SaveValueInfo(LocationInterceptionArgs args, LoggingType loggingType) { try { LogItem item = LogSessionManager.Instance.CurrentSession.GetNewLogItem(); item.HashCode = -1; if (args.Instance != null) { bool firstTime; item.ObjectId = ObjIDGenerator.Instance.GetId(args.Instance, out firstTime); } item.ThreadId = System.Threading.Thread.CurrentThread.ManagedThreadId; item.ProcessId = System.Diagnostics.Process.GetCurrentProcess().Id; item.Name = args.LocationName; item.ClassName = args.Location.DeclaringType.Name; item.Namespace = args.Location.DeclaringType.Namespace; item.LoggingType = loggingType; try { var stackFrame = new StackFrame(3); item.ParentMethod = stackFrame.GetMethod().Name; item.ParentClass = stackFrame.GetMethod().DeclaringType.Name; item.ParentNamespace = stackFrame.GetMethod().DeclaringType.Namespace; } catch { } Database.Instance.Add(item); } catch (Exception ex) { SimpleLogger.Logger.Log("SaveValueInfo", ex); throw; } }
protected override void LogMessageInternal( LoggingType messageType, string message ) { switch( messageType ) { case LoggingType.Debug: case LoggingType.AudioOutputDebug: case LoggingType.CodecDebug: case LoggingType.TransformerDebug: #if DEBUG Console.ForegroundColor = ConsoleColor.Gray; Console.WriteLine( message ); Console.ResetColor(); #endif break; case LoggingType.Error: case LoggingType.AudioOutputError: case LoggingType.CodecError: case LoggingType.TransformerError: Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine( "ERRROR: " + message ); Console.ResetColor(); break; case LoggingType.Normal: case LoggingType.AudioOutputNormal: case LoggingType.CodecNormal: case LoggingType.TransformerNormal: Console.WriteLine( message ); break; case LoggingType.Warning: case LoggingType.AudioOutputWarning: case LoggingType.CodecWarning: case LoggingType.TransformerWarning: Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine( "Warning: " + message ); Console.ResetColor(); break; } }
/// <summary> /// 日志文件全路径 /// </summary> private static string LogFilePath(LoggingType logType) { switch (logType) { case LoggingType.DbInfo: //基本信息日志路径 if (string.IsNullOrEmpty(_InfoLogFilePath)) { _InfoLogFilePath = GenerateFilePath(logType); } else { //当前日志文件路径不为空,那么检查大小是否越界 if (File.Exists(_InfoLogFilePath) && new FileInfo(_InfoLogFilePath).Length > MAX_SIZE_LOG_FILE) { _InfoLogFilePath = GenerateFilePath(logType); } } return(_InfoLogFilePath); case LoggingType.DbError: //基本信息日志路径 if (string.IsNullOrEmpty(_ErrorLogFilePath)) { _ErrorLogFilePath = GenerateFilePath(logType); } else { //当前日志文件路径不为空,那么检查大小是否越界 if (File.Exists(_ErrorLogFilePath) && new FileInfo(_ErrorLogFilePath).Length > MAX_SIZE_LOG_FILE) { _ErrorLogFilePath = GenerateFilePath(logType); } } return(_ErrorLogFilePath); default: throw new Exception("未能识别的日志输出类型!"); } }
public static void RemoteMessage(LoggingSource loggingSource, LoggingType loggingType, string message, params object[] args) { string formattedMessage = string.Format(message, args); bool isSuccess; if ((loggingSource & LoggingSource.Mail) == LoggingSource.Mail) { string subject = loggingType + " логирование с сайта"; var mailerConfig = new MailerConfig { IsHtmlBody = false, DisplayName = subject, SendToAdmins = true }; var mailer = new Mailer.Mailer(); string mailAddress = loggingType.HasFlag(LoggingType.Error) ? MailAddresses.EXCEPTIONS : MailAddresses.SUPPORT; isSuccess = mailer.SendMail(mailAddress, mailAddress, subject, formattedMessage, mailerConfig); if (!isSuccess) { LogTo(LoggerName.Errors).ErrorFormat( "LoggerWrapper.RemoteMessage не удалось отправить сообщение по почте: {0}", formattedMessage); } } /*if ((loggingSource & LoggingSource.Db) == LoggingSource.Db) { * isSuccess = _loggerQuery.Create(loggingType, formattedMessage); * * if (!isSuccess) { * LogTo(LoggerName.Errors).ErrorFormat( * "LoggerWrapper.RemoteMessage не удалось записать сообщение в БД: {0}", * formattedMessage); * } * }*/ }
private void log(LoggingType type, string message, params string[] args) { int imageIndex = 0; switch (type) { case LoggingType.INFO: imageIndex = 0; break; case LoggingType.WARN: imageIndex = 1; break; case LoggingType.ERROR: imageIndex = 2; break; } lvLoggingMessage.Items.Add(new ListViewItem(new string[] { "", DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"), string.Format(message, args) }, imageIndex)); lvLoggingMessage.Invalidate(); }
public static void TraceLog(string message, LoggingType Type) { string tracingDirectory = @"C:\CIPLogs" + "\\" + DateTime.Now.ToString("yyyy-MM") + "\\"; string fileName; StreamWriter sr = null; DateTime now = DateTime.Now; try { if (Directory.Exists(tracingDirectory) == false) { Directory.CreateDirectory(tracingDirectory); } if (tracingDirectory == null || tracingDirectory.Length == 0) { fileName = String.Concat(Type, " - ", now.ToString("dd MMM yyyy HH"), ".txt"); } else { fileName = String.Concat(tracingDirectory, Type, " - ", now.ToString("dd MMM yyyy HH"), ".txt"); } // write message sr = File.AppendText(fileName); sr.WriteLine(DateTime.Now.ToString() + " : " + message); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } finally { if (sr != null) { sr.Close(); } } }
public bool Log(Exception ex, string text, LoggingType logType) { LoggingArgument arg = CreateArgumentForCommonLog(); arg.LogType = logType; if (ex != null) { arg.ExceptionData = new LoggingExceptionData { Exception = ex }; } if (text != null) { arg.InformationData = new LoggingInformationData { Text = text }; } return(Details.LoggingStrategy.Log(arg)); }
public bool HasHistory(string locationID) { if (string.IsNullOrEmpty(locationID)) { throw new ArgumentNullException("locationID"); } bool flag = false; LatencyDetectionLocation latencyDetectionLocation; if (this.container.Locations.TryGetValue(locationID, out latencyDetectionLocation)) { foreach (object obj in Enum.GetValues(typeof(LoggingType))) { LoggingType type = (LoggingType)obj; BackLog backLog = latencyDetectionLocation.GetBackLog(type); flag = (backLog.Count > 0); if (flag) { break; } } } return(flag); }
public static void Log(LoggingType type, string message) { switch (type) { case LoggingType.Error: Error(message); break; case LoggingType.Warning: Warning(message); break; case LoggingType.Info: Info(message); break; case LoggingType.Debug: Debug(message); break; default: break; } }
/// <summary> /// Log message using the given parameters /// </summary> /// <param name="context">Context</param> /// <param name="logType">Logging Type</param> /// <param name="message">Message</param> /// <param name="ex">Exception</param> /// <param name="args">Arguments</param> public override void Log(MethodContext context, LoggingType logType, string message, System.Exception ex, params object[] args) { var log = LogManager.GetLogger(context.Method.DeclaringType); var formatMessage = string.Format(message, args); switch (logType) { case LoggingType.Debug: log.Debug(formatMessage, ex); break; case LoggingType.Information: log.Info(formatMessage, ex);; break; case LoggingType.Warning: log.Warn(formatMessage, ex);; break; case LoggingType.Error: log.Error(formatMessage, ex);; break; } }
public static void Log(LoggingType type, string message) { switch (type) { case LoggingType.Error: Error(message); break; case LoggingType.Warning: Warning(message); break; case LoggingType.Info: Info(message); break; case LoggingType.Debug: Debug(message); break; default: throw new ArgumentOutOfRangeException(nameof(type), type, null); } }
public static void Log(string message, string source, LoggingType type, int level, bool FileOnly) { //Update Paths to logfile FileInfo fileLOG = null; FileInfo fileSource = null; FileInfo fileCritical = null; DateTime now = DateTime.Now; lock (_lockLogging) { try { LogEventData logevent = new LogEventData { Source = source, Message = message, Time = now, Type = type, Level = level }; if (level <= _maxlogLevel && pathToLog != null) { DirectoryInfo tempPath = new DirectoryInfo(pathToLog.FullName + "\\" + String.Format("{0:00}", DateTime.Now.Year) + String.Format("{0:00}", DateTime.Now.Month) + String.Format("{0:00}", DateTime.Now.Day) + "\\"); if (!tempPath.Exists) { Directory.CreateDirectory(tempPath.FullName); } fileLOG = new FileInfo(tempPath.FullName + "!LOG!.txt"); fileSource = new FileInfo(tempPath.FullName + source + ".txt"); fileCritical = new FileInfo(tempPath.FullName + "!!! CRITICAL !!!.txt"); } if (fileLOG != null) { using (System.IO.StreamWriter file = new System.IO.StreamWriter(fileLOG.FullName, true)) { switch (type) { case LoggingType.Error: file.WriteLine(FormatDate(DateTime.Now) + ": ERROR: " + source + " [" + level + "]: " + message); break; case LoggingType.Status: file.WriteLine(FormatDate(DateTime.Now) + ": " + source + " [" + level + "]: " + message); break; case LoggingType.Critical: file.WriteLine(FormatDate(DateTime.Now) + ": CRITICAL: " + source + " [" + level + "]: " + message); break; } } } if (fileSource != null) { using (System.IO.StreamWriter file = new System.IO.StreamWriter(fileSource.FullName, true)) { switch (type) { case LoggingType.Error: file.WriteLine(FormatDate(DateTime.Now) + ": ERROR: " + source + " [" + level + "]: " + message); break; case LoggingType.Status: file.WriteLine(FormatDate(DateTime.Now) + ": " + source + " [" + level + "]: " + message); break; case LoggingType.Critical: file.WriteLine(FormatDate(DateTime.Now) + ": CRITICAL: " + source + " [" + level + "]: " + message); break; } } } if (fileCritical != null) { using (System.IO.StreamWriter file = new System.IO.StreamWriter(fileCritical.FullName, true)) { if (type == LoggingType.Critical) { file.WriteLine(FormatDate(DateTime.Now) + ": CRITICAL: " + source + " [" + level + "]: " + message); } } } //Write to console if (level <= _maxlogLevel) { Console.WriteLine(now.ToString() + ":\t" + source + "\t" + message); } //Fire log event if (LogEvent != null) { LogEvent(logevent); } } catch (Exception ex) { Console.WriteLine("Error while logging to file! " + ex.Message); } } }
public static void Log(string message, string source, LoggingType type, int level) { Log(message, source, type, level, false); }
public bool HasLogger(LoggingType type) { return(this.loggers.ContainsKey(type)); }
public void LogMessage( LoggingType messageType, string message ) { lock( logLock ) { LogMessageInternal( messageType, message ); } }
public override void Log(MethodContext context, LoggingType logType, string message, Exception ex, params object[] args) { logs.Add(new Tuple <MethodContext, LoggingType, string, Exception, object[]>(context, logType, message, ex, args)); }
protected override void LogWork(LoggingType type, string message) { _logger.Log(type, message); }
public void Log(LoggingType type, string message) { }
/// <summary> /// No-op implementation. /// </summary> /// <param name="message"></param> /// <param name="type"></param> /// <param name="foreColor"></param> /// <param name="backColor"></param> public void LogMessage(string message, LoggingType type, Color.Preset foreColor = Color.Preset.Gray, Color.Preset backColor = Color.Preset.Black) { }
public static void Log( LoggingType messageType, string message ) { lock( loggersLock ) { loggers.ForEach( l => l.LogMessage( messageType, message ) ); } }
protected abstract void LogWork(LoggingType type, string message);
public static void LogFormat( LoggingType messageType, string format, params object[] args ) { string message = String.Format( format, args ); Log( messageType, message ); }
/// <summary> /// Set logging status /// </summary> /// <param name="type">Type of logging to set status for</param> /// <param name="status">Status of logging</param> public void SetStatus(LoggingType type, LogsStatus status) { this._logMap[type] = status; }
public Logging(Account account, LoggingType type, string subject, string clientIp) : this(account.Id, account.Username, type, subject, clientIp) { }
/// <summary> /// Get logging status for a specified type /// </summary> /// <param name="type">Type of logging</param> /// <returns>Logging status for that type</returns> public LogsStatus GetStatus(LoggingType type) { return this._logMap[type]; }
public LatencyReportingThreshold GetThreshold(LoggingType type) { return(this.location.GetThreshold(type)); }
private void InitialiseBuildSettings() { #region Required Elements if (string.IsNullOrEmpty(CssCompressionType)) { LogMessage("No Compression type defined. Defaulting to 'YuiStockCompression'."); CssCompressionType = "YUIStockCompression"; } switch (CssCompressionType.ToLowerInvariant()) { case "michaelashsregexenhancements": _cssCompressionType = Compressor.CssCompressionType.MichaelAshRegexEnhancements; break; case "havemycakeandeatit": case "bestofbothworlds": case "hybrid": _cssCompressionType = Compressor.CssCompressionType.Hybrid; break; default: _cssCompressionType = Compressor.CssCompressionType.StockYuiCompressor; break; } if (string.IsNullOrEmpty(LoggingType)) { Log.LogWarning("No logging argument defined. Defaulting to 'ALittleBit'."); LoggingType = "ALittleBit"; } switch (LoggingType) { case "none": _loggingType = MsBuild.LoggingType.None; break; case "hardcorebringiton": _loggingType = MsBuild.LoggingType.HardcoreBringItOn; break; default: _loggingType = MsBuild.LoggingType.ALittleBit; break; } #endregion #region Optional Elements // Optional property. _deleteCssFiles = !string.IsNullOrEmpty(DeleteCssFiles) && ParseSillyTrueFalseValue(DeleteCssFiles.ToUpperInvariant()); // Optional property. _deleteJavaScriptFiles = !string.IsNullOrEmpty(DeleteJavaScriptFiles) && ParseSillyTrueFalseValue(DeleteJavaScriptFiles.ToUpperInvariant()); // Optional Property. _obfuscateJavaScript = !string.IsNullOrEmpty(ObfuscateJavaScript) && ParseSillyTrueFalseValue(ObfuscateJavaScript.ToUpperInvariant()); // Optional Property. _preserveAllSemicolons = !string.IsNullOrEmpty(PreserveAllSemicolons) && ParseSillyTrueFalseValue(PreserveAllSemicolons.ToUpperInvariant()); // Optional Property. _disableOptimizations = !string.IsNullOrEmpty(DisableOptimizations) && ParseSillyTrueFalseValue(DisableOptimizations.ToUpperInvariant()); // Optional Property. int tempLineBreakPosition; if (!string.IsNullOrEmpty(LineBreakPosition) && int.TryParse(LineBreakPosition, out tempLineBreakPosition)) { _lineBreakPosition = tempLineBreakPosition; } else { _lineBreakPosition = -1; } // Optional Property. if (!string.IsNullOrEmpty(EncodingType)) { switch (EncodingType.ToLowerInvariant()) { case "ascii": _encoding = Encoding.ASCII; break; case "bigendianunicode": _encoding = Encoding.BigEndianUnicode; break; case "unicode": _encoding = Encoding.Unicode; break; case "utf32": case "utf-32": _encoding = Encoding.UTF32; break; case "utf7": case "utf-7": _encoding = Encoding.UTF7; break; case "": case "utf8": case "utf-8": _encoding = Encoding.UTF8; break; default: _encoding = Encoding.Default; break; } } else { _encoding = Encoding.Default; } // Optional Property. if (!string.IsNullOrEmpty(ThreadCulture)) { try { _threadCulture = CultureInfo.CreateSpecificCulture(ThreadCulture); } catch { LogMessage("Failed to read in a legitimate culture value. As such, this property will *not* be set."); } } else { _threadCulture = CultureInfo.CreateSpecificCulture("en-GB"); } // Optional property. _isEvalIgnored = !string.IsNullOrEmpty(IsEvalIgnored) && ParseSillyTrueFalseValue(IsEvalIgnored.ToUpperInvariant()); #endregion }
public CustomErrorReporter(LoggingType loggingType) { this.loggingType = loggingType; ErrorMessages = new StringCollection(); }
/// <summary> /// Reads the experiment logging configuration. /// </summary> /// <param name="xmlConfig">The reference to the XML configuration file.</param> /// <param name="loggingType">The type of logging (evolution, evaluation, etc.).</param> /// <param name="parentElementName">The name of the top-level logging configuration element.</param> /// <returns>A constructed data logger.</returns> public static IDataLogger ReadDataLogger(XmlElement xmlConfig, LoggingType loggingType, string parentElementName) { IDataLogger dataLogger = null; XmlElement xmlLoggingConfig = null; int cnt = 0; // Get root of novelty configuration section XmlNodeList nodeList = xmlConfig.GetElementsByTagName(parentElementName, ""); // Iterate through the list of logging configurations, finding one that matches the specified logging type foreach (XmlElement curXmlLoggingConfig in nodeList) { if (loggingType == LoggingParameterUtils.ConvertStringToLoggingType(XmlUtils.TryGetValueAsString(curXmlLoggingConfig, "Type"))) { xmlLoggingConfig = curXmlLoggingConfig; break; } } // If no appropriate logger was found, just return null (meaning there won't be any logging for this type) if (xmlLoggingConfig == null) return null; // Get the logging destination LoggingDestination loggingDestination = LoggingParameterUtils.ConvertStringToLoggingDestination( XmlUtils.TryGetValueAsString(xmlLoggingConfig, "Destination")); // Configure a file-based logger if (LoggingDestination.File == loggingDestination) { // Read in the log file name string logFileName = XmlUtils.TryGetValueAsString(xmlLoggingConfig, "LogFile"); // Instantiate the file data logger dataLogger = new FileDataLogger(logFileName); } else if (LoggingDestination.Database == loggingDestination) { // Read in the experiment configuration and run number string experimentConfigurationName = XmlUtils.TryGetValueAsString(xmlLoggingConfig, "ExperimentConfigurationName"); if (LoggingType.Evolution == loggingType) { // Instantiate the evolution database data logger dataLogger = new NoveltyExperimentEvaluationEntityDataLogger(experimentConfigurationName); } else if (LoggingType.Evaluation == loggingType) { // Instantiate the evaluation database data logger dataLogger = new NoveltyExperimentOrganismStateEntityDataLogger(experimentConfigurationName); } } return dataLogger; }
public override bool Execute() { var files = new List <string>(); if (RequireConfigs != null) { files = RequireConfigs.Select(r => r.GetMetadata("FullPath")).ToList(); } var entryPointOveride = string.Empty; if (EntryPointOverride != null) { entryPointOveride = EntryPointOverride.GetMetadata("FullPath"); } var LogLevel = LoggingType.ToLowerInvariant() == "debug" ? MessageImportance.High : MessageImportance.Normal; this.configProcessor = ConfigProcessorFactory.Create(AutoCompressor, ProjectPath, PackagePath, entryPointOveride, files, FileHelpers.ParseEncoding(EncodingType), Log, LogLevel); var bundles = new List <Bundle>(); try { bundles = this.configProcessor.ParseConfigs(); } catch (Exception ex) { var isDebugLogging = LoggingType.ToLower() == "debug"; Log.LogErrorFromException(ex, isDebugLogging, true, "RequireCompressorTask"); return(false); } if (bundles.Any()) { EnsureOutputDirectoriesExist(bundles); var compressor = new JavaScriptCompressor { Encoding = FileHelpers.ParseEncoding(EncodingType) }; foreach (var bundle in bundles) { if (!bundle.Files.Any()) { continue; } var taskEngine = new CompressorTaskEngine(new MsBuildLogAdapter(Log), compressor) { CompressionType = CompressionType, DeleteSourceFiles = false, EncodingType = EncodingType, LineBreakPosition = -1, LoggingType = LoggingType, OutputFile = bundle.Output, SourceFiles = bundle.Files.ToArray() }; taskEngine.Execute(); } } return(true); }
protected abstract void LogMessageInternal( LoggingType messageType, string message );
public void AddEvent(string _name, string _serial, string _message, LoggingType _type) { AddEvent(0, _name, _serial, _message, _type, DateTime.Now); }
private void AddEvent(int _answerid, string _name, string _serial, string _message, LoggingType _type, DateTime _created) { arParams = new SqlParameter[6]; arParams[0] = new SqlParameter("@answerid", _answerid); arParams[1] = new SqlParameter("@name", _name); arParams[2] = new SqlParameter("@serial", _serial); arParams[3] = new SqlParameter("@message", _message); arParams[4] = new SqlParameter("@type", _type); arParams[5] = new SqlParameter("@created", _created); SqlHelper.ExecuteNonQuery(dsn, CommandType.StoredProcedure, "pr_addEventLog", arParams); }
public void RemoveLogger(LoggingType type) { this.loggers.Remove(type); }
internal LatencyReportingThreshold(LoggingType type, TimeSpan threshold) : this(type, 1, LatencyReportingThreshold.defaultRequiredWithin, threshold) { }
/// <summary> /// Reads the experiment logging configuration with the default top-level configuration element "LoggingConfig". /// </summary> /// <param name="xmlConfig">The reference to the XML configuration file.</param> /// <param name="loggingType">The type of logging (evolution, evaluation, etc.).</param> /// <returns>A constructed data logger.</returns> public static IDataLogger ReadDataLogger(XmlElement xmlConfig, LoggingType loggingType) { return ReadDataLogger(xmlConfig, loggingType, "LoggingConfig"); }
/// <summary> /// Get logging status for a specified type /// </summary> /// <param name="type">Type of logging</param> /// <returns>Logging status for that type</returns> public LogsStatus GetStatus(LoggingType type) { return(this._logMap[type]); }
public static void Log(string message, object source, int instance, LoggingType type, int level) { string _source = source.GetType().ToString() + "_" + instance; Log(message, _source, type, level, false); }
private void ParseLoggingType() { if (string.IsNullOrEmpty(this.LoggingType)) { this.LogType = Yui.Compressor.LoggingType.Info; this.LogMessage("No logging argument defined. Defaulting to 'Info'."); return; } switch (this.LoggingType.ToLowerInvariant()) { case "none": this.LogType = Yui.Compressor.LoggingType.None; break; case "debug": this.LogType = Yui.Compressor.LoggingType.Debug; break; case "info": this.LogType = Yui.Compressor.LoggingType.Info; break; default: throw new ArgumentException("Logging Type: " + LoggingType + " is invalid.", "LoggingType"); } }
public static void Log( LoggingType messageType, params string[] lines ) { // TODO: Is there a better way of doing this than String.Join() ? string message = String.Join( Environment.NewLine, lines ); Log( messageType, message ); }