pryLogger 0.1.1
There is a newer version of this package available.
See the version list below for details.
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
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#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
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
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 | Versions 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.
-
.NETFramework 4.0
- MrAdvice (>= 2.9.9)
- Newtonsoft.Json (>= 13.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
- Introduced database connection management.
- Added logging functionality, and errNotifiers.
- Implemented event management for REST APIs and databases.