本文整理汇总了C#中ILogWriter类的典型用法代码示例。如果您正苦于以下问题:C# ILogWriter类的具体用法?C# ILogWriter怎么用?C# ILogWriter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ILogWriter类属于命名空间,在下文中一共展示了ILogWriter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: HttpClientContextImp
/// <summary>
/// Initializes a new instance of the <see cref="HttpClientContextImp"/> class.
/// </summary>
/// <param name="secured">true if the connection is secured (SSL/TLS)</param>
/// <param name="remoteEndPoint">client that connected.</param>
/// <param name="requestHandler">delegate handling incoming requests.</param>
/// <param name="disconnectHandler">delegate being called when a client disconnectes</param>
/// <param name="stream">Stream used for communication</param>
/// <exception cref="SocketException">If beginreceive fails</exception>
/// <param name="writer">delegate used to write log entries</param>
/// <see cref="RequestReceivedHandler"/>
/// <see cref="ClientDisconnectedHandler"/>
public HttpClientContextImp(bool secured, IPEndPoint remoteEndPoint,
RequestReceivedHandler requestHandler,
ClientDisconnectedHandler disconnectHandler,
Stream stream, ILogWriter writer)
{
Check.Require(requestHandler, "requestHandler");
Check.Require(remoteEndPoint, "remoteEndPoint");
Check.Require(remoteEndPoint.Address, "remoteEndPoint.Address");
Check.Require(stream, "stream");
if (!stream.CanWrite || !stream.CanRead)
throw new ArgumentException("Stream must be writeable and readable.");
_remoteEndPoint = remoteEndPoint;
_log = writer ?? NullLogWriter.Instance;
_parser = new HttpRequestParser(OnRequestCompleted, null);
_secured = secured;
_requestHandler = requestHandler;
_disconnectHandler = disconnectHandler;
_stream = stream;
try
{
_stream.BeginRead(_buffer, 0, BUFFER_SIZE, OnReceive, null);
}
catch (IOException err)
{
_log.Write(this, LogPrio.Debug, err.ToString());
_stream = null;
_disconnectHandler(this, SocketError.ConnectionAborted);
}
}
开发者ID:3di,项目名称:3di-viewer-rei-libs,代码行数:42,代码来源:HttpClientContextImp.cs
示例2: AsyncLogger
/// <summary>
/// Creates an asynchronous logger using the provider log writer.
/// </summary>
/// <param name="writer">The log writer that will log the log entries.</param>
public AsyncLogger(ILogWriter writer)
{
if (writer == null)
throw new ArgumentNullException(nameof(writer));
this.writer = writer;
}
开发者ID:MarinAtanasov,项目名称:AppBrix.NetCore,代码行数:11,代码来源:AsyncLogger.cs
示例3: RunTarget
public MSBuildResult[] RunTarget (string target, ProjectConfigurationInfo[] configurations, ILogWriter logWriter,
MSBuildVerbosity verbosity)
{
MSBuildResult[] result = null;
BuildEngine.RunSTA (delegate
{
try {
var project = SetupProject (configurations);
currentLogWriter = logWriter;
var logger = new LocalLogger (file);
buildEngine.Engine.UnregisterAllLoggers ();
buildEngine.Engine.RegisterLogger (logger);
buildEngine.Engine.RegisterLogger (consoleLogger);
consoleLogger.Verbosity = GetVerbosity (verbosity);
// We are using this BuildProject overload and the BuildSettings.None argument as a workaround to
// an xbuild bug which causes references to not be resolved after the project has been built once.
buildEngine.Engine.BuildProject (project, new [] { target }, new Hashtable (), BuildSettings.None);
result = logger.BuildResult.ToArray ();
} catch (InvalidProjectFileException ex) {
var r = new MSBuildResult (
file, false, ex.ErrorSubcategory, ex.ErrorCode, ex.ProjectFile,
ex.LineNumber, ex.ColumnNumber, ex.EndLineNumber, ex.EndColumnNumber,
ex.BaseMessage, ex.HelpKeyword);
logWriter.WriteLine (r.ToString ());
result = new [] { r };
} finally {
currentLogWriter = null;
}
});
return result;
}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:35,代码来源:ProjectBuilder.cs
示例4: HttpClientContext
/// <summary>
/// Initializes a new instance of the <see cref="HttpClientContext"/> class.
/// </summary>
/// <param name="secured">true if the connection is secured (SSL/TLS)</param>
/// <param name="remoteEndPoint">client that connected.</param>
/// <param name="stream">Stream used for communication</param>
/// <param name="parserFactory">Used to create a <see cref="IHttpRequestParser"/>.</param>
/// <param name="bufferSize">Size of buffer to use when reading data. Must be at least 4096 bytes.</param>
/// <exception cref="SocketException">If <see cref="Socket.BeginReceive(byte[],int,int,SocketFlags,AsyncCallback,object)"/> fails</exception>
/// <exception cref="ArgumentException">Stream must be writable and readable.</exception>
public HttpClientContext(bool secured, IPEndPoint remoteEndPoint,
Stream stream, IRequestParserFactory parserFactory, int bufferSize, Socket sock, ILogWriter log)
{
Check.Require(remoteEndPoint, "remoteEndPoint");
Check.NotEmpty(remoteEndPoint.Address.ToString(), "remoteEndPoint.Address");
Check.Require(stream, "stream");
Check.Require(parserFactory, "parser");
Check.Min(4096, bufferSize, "bufferSize");
Check.Require(sock, "socket");
if (!stream.CanWrite || !stream.CanRead)
throw new ArgumentException("Stream must be writable and readable.");
_bufferSize = bufferSize;
RemoteAddress = remoteEndPoint.Address.ToString();
RemotePort = remoteEndPoint.Port.ToString();
_log = log;
_parser = parserFactory.CreateParser(_log);
_parser.RequestCompleted += OnRequestCompleted;
_parser.RequestLineReceived += OnRequestLine;
_parser.HeaderReceived += OnHeaderReceived;
_parser.BodyBytesReceived += OnBodyBytesReceived;
_currentRequest = new HttpRequest();
IsSecured = secured;
if (stream == null)
throw new NullReferenceException ("Null Stream in HttpClientContext");
_stream = stream;
_buffer = new byte[bufferSize];
}
开发者ID:aurora-sim,项目名称:Aurora-Libs,代码行数:42,代码来源:HttpClientContext.cs
示例5: UnregisterLogWriter
public void UnregisterLogWriter(ILogWriter logWriter)
{
lock (SyncroObject)
{
LogWriters.Remove(logWriter);
}
}
开发者ID:maxrogoz,项目名称:COSystemArchitect,代码行数:7,代码来源:BaseLogger.cs
示例6: DefaultRackServer
public DefaultRackServer(int port,IPAddress ipAddress,ILogWriter logWriter)
{
_server = new HttpServer.HttpServer(logWriter);
_ipAddress = ipAddress;
_port = port;
_logWriter = logWriter;
}
开发者ID:PlasticLizard,项目名称:Bracket,代码行数:7,代码来源:DefaultRackServer.cs
示例7: RunTarget
public MSBuildResult[] RunTarget (string target, ProjectConfigurationInfo[] configurations, ILogWriter logWriter,
MSBuildVerbosity verbosity)
{
MSBuildResult[] result = null;
BuildEngine.RunSTA (delegate
{
try {
var project = SetupProject (configurations);
currentLogWriter = logWriter;
var logger = new LocalLogger (file);
engine.UnregisterAllLoggers ();
engine.RegisterLogger (logger);
engine.RegisterLogger (consoleLogger);
consoleLogger.Verbosity = GetVerbosity (verbosity);
project.Build (target);
result = logger.BuildResult.ToArray ();
} catch (Microsoft.Build.Exceptions.InvalidProjectFileException ex) {
var r = new MSBuildResult (
file, false, ex.ErrorSubcategory, ex.ErrorCode, ex.ProjectFile,
ex.LineNumber, ex.ColumnNumber, ex.EndLineNumber, ex.EndColumnNumber,
ex.BaseMessage, ex.HelpKeyword);
logWriter.WriteLine (r.ToString ());
result = new [] { r };
} finally {
currentLogWriter = null;
}
});
return result;
}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:33,代码来源:ProjectBuilder.v4.0.cs
示例8: AddLogWriter
/// <summary>
/// Adds a log writer and binds to a specific log message type
/// </summary>
/// <param name="logMessageType">Type of log message</param>
/// <param name="logWriter">Log writer to add</param>
public void AddLogWriter(NiawaLogType logMessageType, ILogWriter logWriter)
{
//Ensure that more than one instance of a ILogWriter implementation (of a specific type) is not added.
if(_logWriters.ContainsKey(logWriter.GetType().ToString()))
if (_logWriters[logWriter.GetType().ToString()].LogWriterID != logWriter.LogWriterID)
throw new Exception("Cannot add two instances of the same ILogWriter type [" + logWriter.GetType().ToString() + "]. Add a different type of ILogWriter, or add an existing instance of this ILogWriter type.");
//Check for duplicate entry attempts into the LogMessageTypeLogWriters collection
if (_logMessageTypeLogWriters.ContainsKey(logMessageType))
if (_logMessageTypeLogWriters[logMessageType].Contains(logWriter))
throw new Exception("Cannot add the same ILogWriter [" + logWriter.GetType().ToString() + "] for LogMessageType [" + Enum.GetName(logMessageType.GetType(), logMessageType) + "] more than once.");
//add log writer to list
if (!(_logWriters.ContainsKey(logWriter.GetType().ToString())))
_logWriters.Add(logWriter.GetType().ToString(), logWriter);
//add log writer to map
List<ILogWriter> mapLogWriters = null;
//check if log message type already in map
if (_logMessageTypeLogWriters.ContainsKey(logMessageType))
mapLogWriters = _logMessageTypeLogWriters[logMessageType];
else
{
//create new entry of log writers for log message type and add to map
mapLogWriters = new List<ILogWriter>();
_logMessageTypeLogWriters.Add(logMessageType, mapLogWriters);
}
//add log writer to list of log writers mapped to log message type
mapLogWriters.Add(logWriter);
}
开发者ID:nickw4827,项目名称:NiawaAHN_Step2_Logging,代码行数:37,代码来源:BufferedLogger.cs
示例9: AutomaticMigration
public AutomaticMigration(IAccessDb db, IManageMigrations migrations, ILogWriter logger)
{
_db = db;
_migrations = migrations;
_runner=new MigrationTaskRunner(db,logger);
UpdateSelf();
}
开发者ID:venliong,项目名称:SqlFu,代码行数:7,代码来源:AutomaticMigration.cs
示例10: Attach
public void Attach(ILogWriter newLogWriter)
{
if (newLogWriter == null)
throw new ArgumentNullException("newLogWriter");
if (newLogWriter == this.WrappedLogWriter)
return;
ILogWriter prevLogWriter = this.WrappedLogWriter;
Exception detachException = null;
if (this.WrappedLogWriter != null)
{
try
{
prevLogWriter.Detach();
}
catch (Exception ex)
{
detachException = ex;
}
this.WrappedLogWriter.ServerWriteLine(
string.Format("Log writer \"{0}\" is being detached.", this.LogWriterName), TraceLevel.Verbose);
}
this.WrappedLogWriter = newLogWriter;
this.WrappedLogWriter.ServerWriteLine(
string.Format("Log writer \"{0}\" has been attached.", this.LogWriterName), TraceLevel.Verbose);
if (detachException != null)
this.ServerWriteLine(
string.Format("Log writer \"{0}\" had thrown an unexpected exception:\n{1}", prevLogWriter.Name, detachException),
TraceLevel.Error);
}
开发者ID:Celant,项目名称:TerrariaAPI-Server,代码行数:34,代码来源:LogWriterManager.cs
示例11: RunTarget
public MSBuildResult[] RunTarget (string target, ProjectConfigurationInfo[] configurations, ILogWriter logWriter,
MSBuildVerbosity verbosity)
{
MSBuildResult[] result = null;
BuildEngine.RunSTA (delegate
{
try {
var project = SetupProject (configurations);
currentLogWriter = logWriter;
LocalLogger logger = new LocalLogger (Path.GetDirectoryName (file));
engine.UnregisterAllLoggers ();
engine.RegisterLogger (logger);
engine.RegisterLogger (consoleLogger);
consoleLogger.Verbosity = GetVerbosity (verbosity);
project.Build (target);
result = logger.BuildResult.ToArray ();
// } catch (InvalidProjectFileException ex) {
// result = new MSBuildResult[] { new MSBuildResult (false, ex.ProjectFile ?? file, ex.LineNumber, ex.ColumnNumber, ex.ErrorCode, ex.Message) };
} finally {
currentLogWriter = null;
}
});
return result;
}
开发者ID:telebovich,项目名称:monodevelop,代码行数:28,代码来源:ProjectBuilder.v4.0.cs
示例12: DatabaseFactory
public DatabaseFactory(IConnectionString connectionString, ILogWriter logWriter)
{
Checks.Argument.IsNotNull(connectionString, "connectionString");
_connectionString = connectionString.Value;
_logWriter = logWriter;
}
开发者ID:coredweller,项目名称:MP3-Tag-Altering,代码行数:7,代码来源:DatabaseFactory.cs
示例13: RegisterLogWriter
public void RegisterLogWriter(ILogWriter logWriter)
{
lock (SyncroObject)
{
LogWriters.Add(logWriter);
}
}
开发者ID:maxrogoz,项目名称:COSystemArchitect,代码行数:7,代码来源:BaseLogger.cs
示例14: HttpContextFactory
/// <summary>
/// Initializes a new instance of the <see cref="HttpContextFactory"/> class.
/// </summary>
/// <param name="writer">The writer.</param>
/// <param name="bufferSize">Amount of bytes to read from the incoming socket stream.</param>
/// <param name="factory">Used to create a request parser.</param>
public HttpContextFactory(ILogWriter writer, int bufferSize, IRequestParserFactory factory)
{
_logWriter = writer;
_bufferSize = bufferSize;
_factory = factory;
_contextTimeoutManager = new ContextTimeoutManager(ContextTimeoutManager.MonitorType.Thread);
}
开发者ID:Belxjander,项目名称:Asuna,代码行数:13,代码来源:HttpContextFactory.cs
示例15: Run
public MSBuildResult Run (
ProjectConfigurationInfo[] configurations, ILogWriter logWriter, MSBuildVerbosity verbosity,
string[] runTargets, string[] evaluateItems, string[] evaluateProperties)
{
MSBuildResult result = null;
BuildEngine.RunSTA (delegate {
try {
var project = SetupProject (configurations);
currentLogWriter = logWriter;
buildEngine.Engine.UnregisterAllLoggers ();
var logger = new LocalLogger (file);
buildEngine.Engine.RegisterLogger (logger);
if (logWriter != null) {
buildEngine.Engine.RegisterLogger (consoleLogger);
consoleLogger.Verbosity = GetVerbosity (verbosity);
}
if (runTargets != null && runTargets.Length > 0) {
// We are using this BuildProject overload and the BuildSettings.None argument as a workaround to
// an xbuild bug which causes references to not be resolved after the project has been built once.
buildEngine.Engine.BuildProject (project, runTargets, new Hashtable (), BuildSettings.None);
}
result = new MSBuildResult (logger.BuildResult.ToArray ());
if (evaluateProperties != null) {
foreach (var name in evaluateProperties)
result.Properties [name] = project.GetEvaluatedProperty (name);
}
if (evaluateItems != null) {
foreach (var name in evaluateItems) {
BuildItemGroup grp = project.GetEvaluatedItemsByName (name);
var list = new List<MSBuildEvaluatedItem> ();
foreach (BuildItem item in grp) {
var evItem = new MSBuildEvaluatedItem (name, UnescapeString (item.FinalItemSpec));
foreach (DictionaryEntry de in (IDictionary) evaluatedMetadataField.GetValue (item)) {
evItem.Metadata [(string)de.Key] = UnescapeString ((string)de.Value);
}
list.Add (evItem);
}
result.Items[name] = list;
}
}
} catch (InvalidProjectFileException ex) {
var r = new MSBuildTargetResult (
file, false, ex.ErrorSubcategory, ex.ErrorCode, ex.ProjectFile,
ex.LineNumber, ex.ColumnNumber, ex.EndLineNumber, ex.EndColumnNumber,
ex.BaseMessage, ex.HelpKeyword);
logWriter.WriteLine (r.ToString ());
result = new MSBuildResult (new [] { r });
} finally {
currentLogWriter = null;
}
});
return result;
}
开发者ID:alexrp,项目名称:monodevelop,代码行数:59,代码来源:ProjectBuilder.cs
示例16: RunTarget
public MSBuildResult[] RunTarget (string target, ProjectConfigurationInfo[] configurations, ILogWriter logWriter,
MSBuildVerbosity verbosity)
{
if (target == null)
throw new ArgumentNullException ("target");
return builder.RunTarget (target, configurations, logWriter, verbosity);
}
开发者ID:wickedshimmy,项目名称:monodevelop,代码行数:8,代码来源:RemoteProjectBuilder.cs
示例17: Log
public Log(ILogWriter traceWriter, ILogWriter eventLogWriter, string system, bool logSuccesAudit, bool logFailureAudit)
{
this.traceWriter = traceWriter;
this.eventLogWriter = eventLogWriter;
systemLogging = system;
this.logSuccesAudit = logSuccesAudit;
this.logFailureAudit = logFailureAudit;
}
开发者ID:alaendle,项目名称:rhino-mocks,代码行数:8,代码来源:FieldProblem_Mark.cs
示例18: AddLogWriter
public static void AddLogWriter(ILogWriter logWriter, ILogFormatter logFormatter)
{
logWriters.Add(new LogWriterInfo()
{
logWriter = logWriter,
logFormatter = logFormatter
});
}
开发者ID:moszinet,项目名称:HomeAutomation,代码行数:8,代码来源:Log.cs
示例19: HttpRequestParser
/// <summary>
/// Create a new request parser
/// </summary>
/// <param name="requestCompleted">delegate called when a complete request have been generated</param>
/// <param name="logWriter">delegate receiving log entries.</param>
public HttpRequestParser(RequestCompletedHandler requestCompleted, ILogWriter logWriter)
{
if (requestCompleted == null)
throw new ArgumentNullException("requestCompleted");
_log = logWriter ?? NullLogWriter.Instance;
RequestCompleted = requestCompleted;
}
开发者ID:3di,项目名称:3di-viewer-rei-libs,代码行数:13,代码来源:HttpRequestParser.cs
示例20: InitLogger
/// <summary>
/// Prepares the logging infrastructure
/// </summary>
void InitLogger (ILogWriter logWriter)
{
currentLogWriter = logWriter;
if (currentLogWriter != null) {
log.Clear ();
flushingLog = false;
flushTimer = new Timer (o => FlushLog ());
}
}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:12,代码来源:ProjectBuilder.Shared.cs
注:本文中的ILogWriter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论