pryLogger 0.1.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package pryLogger --version 0.1.1                
NuGet\Install-Package pryLogger -Version 0.1.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="pryLogger" Version="0.1.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add pryLogger --version 0.1.1                
#r "nuget: pryLogger, 0.1.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install pryLogger as a Cake Addin
#addin nuget:?package=pryLogger&version=0.1.1

// Install pryLogger as a Cake Tool
#tool nuget:?package=pryLogger&version=0.1.1                

pryLogger

This sample project demonstrates the usage of the pryLogger library for event logging and error handling in a C# application. The application makes REST API calls and configures email/rest notifications in case of errors.

Requirements

  • Connection Database: Ensure you have an database set up with a valid connection string

Usage Example

using System;
using System.Linq;
using System.Text;

using pryLogger.src.Logger.Loggers;
using pryLogger.src.Logger.Loggers.FileLogger;

using pryLogger.src.Logger.Attributes;

using pryLogger.src.Logger.ErrNotifiers.MailErrNotifier;
using pryLogger.src.Logger.ErrNotifiers.RestErrNotifier;

namespace pryLoggerConsole45
{
    class Program
    {
        [Log]
        static string Hello([LogParam("personName")] string name)
        {
            try
            {
                throw new Exception("test exception");
            }
            catch (Exception e)
            {
                LogAttribute.Current?.SetException(e);
            }

            return $"Hello, {name}";
        }

        static void Main(string[] args)
        {
            string fileConnectionString = "filename=log.txt; maxlines=1000";
            string restConnectionString = "url=http://localhost:3000; method=post;";
            string mailConnectionString = "host=smtp.gmail.com; port=587; from=cartoryy@gmail.com; to=cartoryy@gmail.com; password=...; ssl=true";

            var mailErrNotifier = MailErrNotifier.FromConnectionString(mailConnectionString);
            var fileLogger = new FileLogger(fileConnectionString);

            LogAttribute.Instance
                .SetLoggers(ConsoleLogger.Instance, fileLogger)
                .SetErrorNotifiers(mailErrNotifier, RestErrNotifier.FromConnectionString(restConnectionString));

            Console.WriteLine("BEGIN");
            Hello("pryLogger40");
            Console.WriteLine("END");
            Console.ReadKey();
        }
    }
}
Product Compatible and additional computed target framework versions.
.NET Framework net40 is compatible.  net403 was computed.  net45 was computed.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.2.15 130 12/29/2023
0.2.13 184 11/10/2023
0.2.9 108 11/9/2023
0.2.7 106 11/9/2023
0.2.6 124 11/8/2023
0.2.5 107 11/8/2023
0.2.2 122 9/14/2023
0.1.1 92 4/10/2024

- Introduced database connection management.
     - Added logging functionality, and errNotifiers.
     - Implemented event management for REST APIs and databases.