How to Create a "Log Plugin"

"Log Plugins" are supported starting from v1.0.6.9 (as of today, the version is not officially out).

They are similar to usual plugins, they are simple ASP.NET assemblies, which are dynamically connected to the server, and handle custom, user defined logging.

To create a Log Plugin, create an assembly, refer to Argosoft.Plugins assembly, and implement a class which descends from ILogInterface interface:

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using Argosoft.Plugins;

namespace SampleLogPlugin
{
    public class MyLogPlugin : ILogPlugin
    {
        public static void AddToLog(object sender, string msg)
        {
            using (StreamWriter writer = new StreamWriter("c:\\temp\\mylog.txt", true))
            {
                writer.WriteLine(msg);
            }
        }
        private OnLogDelegate onLog = new OnLogDelegate(AddToLog);
        public OnLogDelegate OnLog
        {
            get { return onLog; }
            set { onLog = value; }
        }
    }
}

Then, create a file called LogPlugins.xml in the root of mail server root, content of which looks like:

<?xml version="1.0" encoding="utf-8"?>
<Plugins version="1.0">
    <Item>
        <AssemblyName>SampleLogPlugin</AssemblyName>
        <TypeName>SampleLogPlugin.MyLogPlugin</TypeName>
    </Item>
</Plugins>
        

And, restart the server...