LogRepository.Create Method

Create new log.

Namespace: Gamanet.C4.SDK
Assembly: Gamanet.C4.SimpleClient (in Gamanet.C4.SimpleClient.dll) Version: 2026.0.0.733
Syntax
C#
public void Create(
	SimpleLogV1 log
)

Parameters

log  SimpleLogV1
The log.

Implements

ISimpleClientLogRepositoryV1.Create(SimpleLogV1)
Example
The following example illustrates how SimpleClient creates log
C#
using System;
using Gamanet.C4.SDK;
using Gamanet.C4.SimpleInterfaces;

public class Example
{
    static void Main()
    {
        // Create instance of simple client
        var client = new SimpleClient(ConnectorConfiguration.HttpClient);

        ConnectionInfoV1 token;
        // Connect to local server
        var connectionResult = client.Connect(new Uri("https://localhost/"), "Support", "support", out token);

        if (connectionResult != ConnectionResult.Successful)
        {
            Console.WriteLine("Connection unsuccessful, result: {0}", connectionResult);
            return;
        }

        Console.WriteLine("Connection result: {0}", connectionResult);
        Console.WriteLine();

        var log = new SimpleLogV1(
        Guid.NewGuid(), //log id
        "exampleLog", //log name
        Guid.Empty, // log parent id
        LogCategory.DoorOpened);//log category

        log.Data = new Dictionary<string, object>
        {
            ["DeviceId"] = deviceId,
            ["DeviceIdName"] = deviceName,
            ["SourceTime"] = sourceTime
        };

        // create SimpleLog
        client.Logs.Create(log);

        // Check if log was created
        var createdLog = client.Logs.Get(log.Id);
        Console.WriteLine($"Log with name {createdLog.Name} was created");

        // Disconnect from server
        client.Disconnect();
    }
}
See Also

Reference

LogRepository Class
Gamanet.C4.SDK Namespace
SimpleLogV1