/// <summary>Add a logger object to the logger group.</summary> /// <param name="log">The logable object to add.</param> public void AddLog(ILogable log) { if (log == null) { throw new ArgumentNullException("log", "logger cannot be null"); } logs.Add(log); }
/// <summary>Retrieve the summary row builder for the Log object.</summary> /// <param name="log">The logable item that provides the data.</param> /// <param name="info">The metadata used to build the row.</param> /// <returns></returns> public static IRowBuilder GetSummaryBuilder(ILogable log, LogInfo info) { // TODO Try to find a better way to do this. return (info.OutputData.Type == OutputType.CONSOLE || info.OutputData.Type == OutputType.EMAIL) ? new ConsoleLogRowBuilder(log, info) : GetRowBuilder(log, info); }
public void Log(ILogable data) { using (System.IO.StreamWriter writer = new System.IO.StreamWriter(this.filePath)) { writer.WriteLine(data.ToString()); } }
/// <see cref="ILogable.WriteSummaryEntry"/> public override bool WriteSummaryEntry(ILogable logable) { this.WriteHeader(); bool success = this.output.Write(builder.GetInsertStatement(logable)); output.CloseOutput(); return success; }
public void Log(ILogable obj) { var s = obj.ToLog(); logBuilder.AppendLine(s); Console.WriteLine(s); }
/// <see cref="ILogable.WriteSummaryEntry"/> public override bool WriteSummaryEntry(ILogable logable) { this.WriteHeader(); bool ret = this.WriteToOutput(RowBuilderFactory.GetSummaryBuilder(logable, logInfo)); output.CloseOutput(); return ret; }
/// <summary> /// 构造方法 /// </summary> /// <param name="next">下一个中间件处理委托</param> /// <param name="options">请求日志选项配置</param> /// <param name="log">日志</param> /// <param name="theOperation">本次操作</param> public RequestLogMiddleware(RequestDelegate next, IOptions <RequestLogOptions> options, ILogable log, ITheOperation theOperation = null) { this.next = next; this.options = options.Value; this.log = log; this.theOperation = theOperation; }
public void Log(ILogable data) { using (System.IO.StreamWriter writer = new System.IO.StreamWriter(this.filePath)) { writer.WriteLine(data.GetStringRepresentation()); } }
public void Fatal(ILogable mensaje) { var bsonDoc = mensaje.ToBsonDocument(); ThreadContext.Properties[ActionPropertyname] = bsonDoc; _auditor.Fatal(bsonDoc); }
public CBaseFunctional(string name, IAlarmable alarmer, ILogable logger) { _alarmer = alarmer; _logger = logger; PrintStartUpBanner(); _name = name; }
private void Log(ILogable message) { foreach (var appender in this.Appenders) { appender.Append(message); } }
/// <summary> /// 构造方法 /// 初始化各个对象以便就绪 /// 只初始化交换机与基本属性,队列定义请重写Init方法进行操作 /// </summary> /// <param name="channel">渠道</param> /// <param name="amqpQueue">AMQP队列信息</param> /// <param name="isDeclare">是否定义</param> /// <param name="log">日志</param> public RabbitCoreBase(IModel channel, AmqpQueueInfo amqpQueue, bool isDeclare, ILogable log = null) { ValidateUtil.ValidateNull(channel, "渠道"); ValidateUtil.ValidateNull(amqpQueue, "AMQP队列信息"); this.channel = channel; this.amqpQueue = amqpQueue; if (log == null) { this.log = LogTool.DefaultLog; } else { this.log = log; } if (isDeclare) { channel.ExchangeDeclare(amqpQueue.ExchangeName, amqpQueue.Type, amqpQueue.Persistent); if (amqpQueue.Queue.Qos != null) { channel.BasicQos(0, amqpQueue.Queue.Qos.GetValueOrDefault(), false); } } basicProperties = channel.CreateBasicProperties(); basicProperties.Persistent = amqpQueue.Persistent; Init(); }
public GuetSubViewModel(HttpRequestConfig config, SitesProvider provider, ILogable logger, string fileName) : base(fileName) { requester = new Requester(config); //GuetModelProvider CurrentPage = provider.getSiteModel("Bkjw")?.getWebPageModel(DefaultKey.SelectCourse); this.logger = logger; }
private void CreateStates() { _loggerStates = new CLogger("Connector_States", flushMode: true); StateDisconnected = new CStateConnector_Disconnected(this); StateConnected = new CStateConnector_Connected(this); StateOff = new CStateConnector_Off(this); }
public override void OnActionExecuting(HttpActionContext actionContext) { foreach(var argument in actionContext.ActionArguments.Values.Where(v => v is ILogable))) { ILogable model = argument as ILogable;//assume that only objects implementing this interface are logable //do something with it. Maybe call model.log } }
public void Log(ILogable data) { /* Task 4 * Console.WriteLine(message); */ Console.WriteLine(data.GetStringRepresentation()); }
/// <summary> /// 构造方法 /// </summary> /// <param name="log">日志</param> public PolicyReturnDataCache(ILogable log) { if (log == null) { return; } this.Log = log; }
public string Format(ILogable messageToFormat) { string message = string.Format( "{0} - {1} - {2}", DateTime.Now, messageToFormat.Type.ToString(), messageToFormat.TextMessage); return message; }
public string Format(ILogable messageToFormat) { string message = string.Format( "{0} - {1} - {2}", DateTime.Now, messageToFormat.Type.ToString(), messageToFormat.TextMessage); return(message); }
public override void OnActionExecuting(HttpActionContext actionContext) { foreach(KeyValuePair<string, object> argument in actionContext.ActionArguments) { ILogable model = argument.Value as ILogable;//assume that only objects implementing this interface are logable if (model != null){ //do something with it. Maybe call model.log } } }
private void UpdateLogableItem(ILogable logger) { var timeNow = DateFormater.DateTimeNow; if (logger.CreatedDate == default(DateTime)) { logger.CreatedDate = timeNow; } //if (logger.CreatedBy == default(Guid)) //logger.CreatedBy = EngineContext.Instance.CurrentUser.User.Id; }
/// <summary> /// Charge le logable en testant si il n'est pas null. S'il est null il affiche un message à l'utilisateur /// </summary> /// <param name="unLogable">le Ilogable</param> protected void ChargerLogable(ILogable unLogable) { if (unLogable == null) { MethodesGlobales.AfficherMessageErreurInitialisationILogable(); } else { _monLogable = unLogable; } }
public void Fatal(ILogable mensaje, Exception ex) { var log = new ExcepcionLogable { Mensaje = mensaje.mensaje, StackTrace = (ex != null ? string.Format("{0}\n{1}", ex.Message, ex.StackTrace) : string.Empty) }; var bsonDoc = log.ToBsonDocument(); ThreadContext.Properties[ActionPropertyname] = bsonDoc; _auditor.Fatal(bsonDoc); }
public static void log(this ILogable obj, string message, LogLevel level = LogLevel.INFO) { var module = obj.GetType().ToString().Substring(16); var output = $"{level.ToString()}\t({module}) {message}"; if (level < LogLevel.ERROR) { Console.Out.WriteLine(output); } else { Console.Error.WriteLine(output); } }
private bool disposedValue = false; // To detect redundant calls protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { // TODO: dispose managed state (managed objects). } // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below. // TODO: set large fields to null. DictionaryOfThreads = null; loggerService = null; disposedValue = true; } }
public CBaseFunctional(IAlarmable alarmer, string name = null) { //string name; if (name == null) { _name = this.GetType().Name; } else { _name = name; } _logger = new CLogger(_name); _alarmer = alarmer; PrintStartUpBanner(); }
public void Append(ILogable message) { if ((int)message.Type >= this.Threshold) { string messageToLog = String.Empty; if (this.Layout != null) { messageToLog = this.Layout.Format(message); } else { messageToLog = message.TextMessage; } Console.WriteLine(messageToLog); } }
public CBitfenixWebSockConnector(IClientBfxWebSockCon client, List <CCryptoInstrData> lstInstruments, bool isAuth, string apiKey, string apiSecret) : base(client, "CBitfenixWebSockConnector" + GetPostFix(isAuth)) { _client = client; _lstInstrumentsData = lstInstruments; _apiKey = apiKey; _apiSecret = apiSecret; _isAuth = isAuth; _logRaw = new CLogger("BfxRaw" + GetPostFix(_isAuth)); LogRaw("================================ STARTED ======================================================"); // GenListInstrument(); CreateSockStor(); _perf = new CPerfOrdBook(true); }
/// <summary> /// 构造方法 /// </summary> /// <param name="amqpQueue">AMQP队列信息</param> /// <param name="log">日志</param> public RabbitExceptionHandle(AmqpQueueInfo amqpQueue, ILogable log = null) { if (amqpQueue == null) { throw new ArgumentNullException("AMQP队列信息不能为null"); } this.amqpQueue = amqpQueue; if (log == null) { log = LogTool.DefaultLog; } else { this.log = log; } InitExceptionHandle(); }
public void Append(ILogable message) { if ((int)message.Type >= this.Threshold) { string messageToLog = String.Empty; if (this.Layout != null) { messageToLog = this.Layout.Format(message); } else { messageToLog = message.TextMessage; } using (StreamWriter sw = File.AppendText(this.Path)) { sw.WriteLine(messageToLog); } } }
private void AddEntry(string context, string message, MessageType logType, int stackFrameDiscard) { // Get our stack frame StackFrame frame = new StackFrame(stackFrameDiscard, true); // Create our entry if (string.IsNullOrEmpty(context)) { context = System.IO.Path.GetFileNameWithoutExtension(frame.GetFileName()); } int lineNumber = frame.GetFileLineNumber(); message = FormatLabel(message, context, frame.GetFileLineNumber(), logType); Entry entry = new Entry() { fileName = frame.GetFileName(), lineNumber = lineNumber, message = message, type = logType, id = m_Entries.Count + 1 }; m_Entries.Add(entry); }
/// <summary> /// 构造方法 /// </summary> /// <param name="next">下一个中间件处理委托</param> /// <param name="options">Api异常处理选项配置</param> /// <param name="log">日志</param> public ApiExceptionHandleMiddleware(RequestDelegate next, IOptions <ApiExceptionHandleOptions> options, ILogable log) { this.next = next; this.options = options.Value; this.log = log; }
/// <summary> /// 构造方法 /// </summary> /// <param name="next">下一个中间件处理委托</param> /// <param name="options">请求日志选项配置</param> /// <param name="log">日志</param> public RequestLogMiddleware(RequestDelegate next, IOptions <RequestLogOptions> options, ILogable log) { this.next = next; this.options = options.Value; this.log = log; }
public void Log(ILogable message) { File.WriteAllText(path, message.GetStringRepresentation()); }
/// <see cref="ILogable.WriteSummaryEntry"/> public abstract bool WriteSummaryEntry(ILogable logable);
private int successCount = 0; // Counter for successful tests. #endregion Fields #region Constructors /// <summary>Constructor.</summary> /// <param name="info">The metadata to create the data logging.</param> public Log(LogInfo info) { this.logInfo = info; this.output = OutputFactory.Create(this.logInfo); this.summaryLog = LogFactory.Create(this.logInfo.SummaryLogInfo); }
public CDBGTrdDispatcher(ILogable log) { _log = log; }
public void Remove(ILogable log) { log.RemoveLog(); this.logList.Remove(log); }
public void Add(ILogable log) { log.AddLog(this); this.logList.Add(log); }
/// <summary>Constructor.</summary> /// <param name="logable">The object that constains the row of data.</param> /// <param name="info">The metadata used to build the row.</param> public ConsoleLogRowBuilder(ILogable logable, LogInfo info) : base(logable, info) { }