Coder Social home page Coder Social logo

prism.plugin.logging's Introduction

Prism Logging Plugin's

Prism's ILoggerFacade provides logging of all internal Prism errors, and a quick and easy way for your WPF, UWP, or Xamarin Forms app to introduce logging throughout your ViewModels and Services. The implementation of ILoggerFacade is really left to the developer to determine how you want to handle your logging. Using the Logging Plugins will allow you to rapidly configure remote network based logging.

NOTE These packages only take a dependency on Prism.Core and as such will work in any project using Prism.

Current Build

NuGet

Package NuGet MyGet
Prism.Logging.Common CommonLoggingShield CommonLoggingMyGetShield
Prism.Logging.Graylog GraylogLoggingShield GraylogLoggingMyGetShield
Prism.Logging.Loggly LogglyLoggingShield LogglyLoggingMyGetShield
Prism.Logging.Syslog SyslogLoggingShield SyslogLoggingMyGetShield

Support

If this project helped you reduce time to develop and made your app better, please help support this project.

paypal

Providers

The Plugin supports various Network based Logging providers to better assist you in collecting data on your apps.

SocketLogger

The SocketLogger is configurable to send messages using any Socket Type you choose. Typically you would choose Udp or Tcp. This works great for simple solutions where you simply want to receive logging messages over the network.

public class SocketOptions : ISocketLoggerOptions
{
    // e.g. 192.168.0.100
    // e.g. logging.contoso.com
    public string HostOrIp => Secrets.LoggingHost;

    public int Port => 12345;

    public ProtocolType ProtocolType => ProtocolType.Udp;
}

public class App : PrismApplication
{
    protected override void RegisterTypes()
    {
        Container.Register<ISocketLoggerOptions, SocketOptions>();
        Container.Register<ILoggerFacade, SocketLogger>();
    }
}

Syslog

The Syslog package will enable you to send your logging messages to the Syslog Server of your choice, and works great with Visual Syslog Server.

public class AwesomeAppOptions : ISyslogOptions
{
    // e.g. 192.168.0.100
    // e.g. logging.contoso.com
    public string HostNameOrIp => Secrets.LoggingHost;

    // If this is null, the SyslogLogger will use port 514
    public int? Port => int.Parse(Secrets.LoggingPort);

    public string AppNameOrTag => "AwesomeApp"
}

public class App : PrismApplication
{
    protected override void RegisterTypes()
    {
        Container.Register<ISyslogOptions, AwesomeAppOptions>();
        Container.Register<ILoggerFacade, SyslogLogger>();
    }
}

Loggly

Loggly offers both free and paid Logging as a Service plans. The Loggly package will allow you to choose from either their Syslog implementation or Rest service.

NOTE By default we will send all requests to logs-01.loggly.com. To override this you will need to inherit from the Logging class.

  • For LogglyHttpLogger you will need to override LogglyBaseUri's default value of https://logs-01.loggly.com
  • For LogglySyslogLogger you will need to implement a Logger class that derives from LogglySyslogLogger and update the HostNameOrIp property.
public class LogglyOptions : ILogglyOptions
{
    public string Token => Secrets.LogglyToken;

    public string AppName => "AwesomeApp";

    public IEnumerable<string> Tags => new string[]
    {
        "sample"
    };
}

public class App : PrismApplication
{
    protected override void RegisterTypes()
    {
        // Used by both the LogglyHttpLogger and LogglySyslogLogger
        Container.Register<ILogglyOptions, LogglyOptions>();

        Container.Register<ILoggerFacade, LogglyHttpLogger>();
        // Or
        Container.Register<ILoggerFacade, LogglySyslogLogger>();
    }
}

Graylog (Graylog Extended Log Format)

Graylog is a very popular Logging platform which will accept Syslog messages. In addition to the Syslog Messages, you can also choose to use the Graylog package to take advantage of the Graylog REST Api and GELF Log Messages.

public class GelfOptions : IGelfOptions
{
    // e.g. http://graylog.example.org:12202
    public Uri Host => new Uri(Secrets.GraylogHost);
}

public class App : PrismApplication
{
    protected override void RegisterTypes()
    {
        Container.Register<IGelfOptions, GelfOptions>();
        Container.Register<ILoggerFacade, GelfLogger>();
    }
}

prism.plugin.logging's People

Contributors

dansiegel avatar radoslawkubas avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.