https://github.com/urskroell/userlognet
A dotnet SDK for UserLog
https://github.com/urskroell/userlognet
csharp dotnet nuget-package sdk-dotnet sdk-net userlog
Last synced: 5 months ago
JSON representation
A dotnet SDK for UserLog
- Host: GitHub
- URL: https://github.com/urskroell/userlognet
- Owner: UrsKroell
- License: mit
- Created: 2025-02-15T17:52:35.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-02-15T18:47:27.000Z (over 1 year ago)
- Last Synced: 2026-02-17T05:02:32.575Z (5 months ago)
- Topics: csharp, dotnet, nuget-package, sdk-dotnet, sdk-net, userlog
- Language: C#
- Homepage:
- Size: 22.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# UserLogNET
### a UserLog SDK for dotnet

-----
Website: https://getuserlog.com/
Docs: https://docs.getuserlog.com/
## Installation
```sh
dotnet add package UserLogNET
```
## Usage
### Add client to dependency injection
```csharp
using UserLogNET.Extensions;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddUserLog("api-key", "project-name");
```
The project name will be auto-injected in all requests.
### Log
```csharp
using UserLogNET;
using UserLogNET.Client;
// Inject UserLogClient into service
public GenericController(IUserLogClient userLogClient)
{
_userLogClient = userLogClient;
}
public async Task Get()
{
// Create a new UserLogEvent
var newLogEvent = new UserLogEvent()
{
Channel = "payments", // Required
Event = "New Subscription", // Required
Notify = true, // Required
Description = "A new subscription was created", // optional
UserId = "user@example.local", // optional
Icon = "💰" // optional (needs to be an emoji)
};
// Add Tags (optional)
newLogEvent.AddTags(
("plan", "hello"), // supports string
("cycle", "monthly"),
("mrr", 19.95), // numbers
("trial", true) // and bool
);
// push the LogEvent to be tracked
return await _userLogClient.Track(newLogEvent);
}
```