Ejemplo n.º 1
0
    public SyslogClientInstaller(SyslogClientOptions options, string appName, string kind, LogPriority minimalPriority)
    {
        try
        {
            this.Client = new SyslogClient(options, appName);

            this.LogRoute = new SyslogClientLogRoute(this.Client, appName, kind, minimalPriority);

            LocalLogRouter.Router?.InstallLogRoute(this.LogRoute);
        }
        catch
        {
            this._DisposeSafe();

            throw;
        }
    }
Ejemplo n.º 2
0
    public SyslogClient(SyslogClientOptions options, string appName)
    {
        try
        {
            this.AppName = appName._FilledOrDefault(Path.GetFileNameWithoutExtension(Env.AppExecutableExeOrDllFileName));

            this.Options = options;

            this.UdpListener_IPv4 = TcpIp.CreateUdpListener(new NetUdpListenerOptions(TcpDirectionType.Client, new IPEndPoint(IPAddress.Any, 0)));
            this.UdpSock_IPv4     = this.UdpListener_IPv4.GetSocket(true);

            this.UdpListener_IPv6 = TcpIp.CreateUdpListener(new NetUdpListenerOptions(TcpDirectionType.Client, new IPEndPoint(IPAddress.IPv6Any, 0)));
            this.UdpSock_IPv6     = this.UdpListener_IPv6.GetSocket(true);

            this.MainProcTask = this.StartMainLoop(MainLoopAsync);
        }
        catch
        {
            this._DisposeSafe();
            throw;
        }
    }