Click or drag to resize

ILog Interface

Provides the methods used to log messages.

Namespace:  AGI.Parallel.Infrastructure.Logging
Assembly:  AGI.Parallel.Infrastructure (in AGI.Parallel.Infrastructure.dll) Version: 2.9.0.1601 (2.9.0.1601)
Syntax
public interface ILog
Methods
  NameDescription
Public methodDebug(Object)
Log a message object with the Debug level.
Public methodDebug(Object, Exception)
Log a message object with the Debug level including the stack trace of the System.Exception passed as a parameter.
Public methodDebugFormat(String, Object)
Logs a formatted message string with the Debug level.
Public methodDebugFormat(String, Object)
Logs a formatted message string with the Debug level.
Public methodDebugFormat(String, Object, Object)
Logs a formatted message string with the Debug level.
Public methodError(Object)
Log a message object with the Error level.
Public methodError(Object, Exception)
Log a message object with the Error level including the stack trace of the System.Exception passed as a parameter.
Public methodErrorFormat(String, Object)
Logs a formatted message string with the Error level.
Public methodErrorFormat(String, Object)
Logs a formatted message string with the Error level.
Public methodErrorFormat(String, Object, Object)
Logs a formatted message string with the Error level.
Public methodFatal(Object)
Log a message object with the Fatal level.
Public methodFatal(Object, Exception)
Log a message object with the Fatal level including the stack trace of the System.Exception passed as a parameter.
Public methodFatalFormat(String, Object)
Logs a formatted message string with the Fatal level.
Public methodFatalFormat(String, Object)
Logs a formatted message string with the Fatal level.
Public methodFatalFormat(String, Object, Object)
Logs a formatted message string with the Fatal level.
Public methodInfo(Object)
Log a message object with the Info level.
Public methodInfo(Object, Exception)
Log a message object with the Info level including the stack trace of the System.Exception passed as a parameter.
Public methodInfoFormat(String, Object)
Logs a formatted message string with the Info level.
Public methodInfoFormat(String, Object)
Logs a formatted message string with the Info level.
Public methodInfoFormat(String, Object, Object)
Logs a formatted message string with the Info level.
Public methodWarn(Object)
Log a message object with the Warn level.
Public methodWarn(Object, Exception)
Log a message object with the Warn level including the stack trace of the System.Exception passed as a parameter.
Public methodWarnFormat(String, Object)
Logs a formatted message string with the Warn level.
Public methodWarnFormat(String, Object)
Logs a formatted message string with the Warn level.
Public methodWarnFormat(String, Object, Object)
Logs a formatted message string with the Warn level.
Top
Examples
using System;
using AGI.Parallel.Client;
using AGI.Parallel.Infrastructure;
using AGI.Parallel.Infrastructure.Logging;

namespace CodeSamples
{
    class Program
    {
        static void Main(string[] args)
        {
            using (IJobScheduler scheduler = new ClusterJobScheduler("localhost"))
            {
                scheduler.Connect();
                Job job = scheduler.CreateJob();
                job.AddTask(new WriteSomeToLog());
                job.Submit();
                job.WaitUntilDone();
            }

            /*
             * Go to %ALLUSERSPROFILE%\AGI\STK Parallel Computing Server 2.9\logs to inspect the log files.
             */
        }

        [Serializable]
        class WriteSomeToLog : Task
        {
            public override void Execute()
            {
                ILog logger = this.GetProperty<ILog>(TaskProperties.Logger);

                logger.Error("My text");
                logger.Fatal("should appear");
                logger.Fatal("in the file");
            }
        }
    }
}
See Also

STK Parallel Computing Server 2.9 API for .NET