Introduced Newtonsoft.Json-backed persistence. Improved backing-store reliability and serialization across the caching stack. Improved networking security posture. Key changes: - Add new GameCult.Caching.NewtonsoftJson project with SingleFile/MultiFile backing stores and polymorphic known-type envelopes. - Add MessagePack helper serialization (DatabaseEntrySerialization) and update MessagePack backing stores to use the shared options/resolver; add DatabaseLink formatter and generator/analyzer docs. - Update CultLib.sln to include the new projects and new caching tests project. - Improve CultCache persistence behavior: track pending store operations, wait for operations on PullAll, and centralize async push handling with error logging. - Harden file I/O in multi-file/single-file stores: atomic temp-file writes, safe Replace/Move semantics, rename-safe deletes, and improved file-watcher subscription and debounce disposal. - Add README files and documentation for several subprojects and packaging projects. These changes add JSON persistence support, improve serialization consistency, and make on-disk operations more robust and observable.
69 lines
1.8 KiB
Markdown
69 lines
1.8 KiB
Markdown
# GameCult.Logging
|
|
|
|
`GameCult.Logging` provides a common logging contract for cache, networking, and Unity-facing code.
|
|
|
|
## Scope
|
|
|
|
This package provides a minimal logging abstraction. It does not provide structured logging, external sinks, scopes, or framework integration.
|
|
|
|
It is designed for:
|
|
|
|
- simple runtime diagnostics
|
|
- lightweight library dependencies
|
|
- swapping logging behavior by environment
|
|
- avoiding a hard dependency on a specific logging ecosystem
|
|
|
|
## Included Types
|
|
|
|
- `ILogger`: interface with `LogInfo`, `LogWarning`, `LogError`, and `LogDebug`
|
|
- `NullLogger`: no-op implementation
|
|
- `ConsoleLogger`: writes to `System.Console`
|
|
- `FileLogger`: appends timestamped log lines to a file
|
|
- `UnityLogger`: Unity-specific implementation in `src/GameCult.Logging.Unity`
|
|
|
|
## Behavior Notes
|
|
|
|
- `NullLogger` is the safe default used by other libraries when no logger is supplied.
|
|
- `ConsoleLogger` colors warnings and errors.
|
|
- `FileLogger` writes plain text entries with timestamps.
|
|
- `UnityLogger` schedules logging to the next Unity frame instead of writing immediately.
|
|
|
|
## Typical Usage
|
|
|
|
```csharp
|
|
using GameCult.Logging;
|
|
|
|
ILogger logger = new ConsoleLogger();
|
|
|
|
logger.LogInfo("Server starting");
|
|
logger.LogWarning("High latency detected");
|
|
logger.LogError("Connection failed");
|
|
```
|
|
|
|
## Swapping Implementations
|
|
|
|
Consumers can choose the implementation that fits the runtime.
|
|
|
|
```csharp
|
|
using GameCult.Logging;
|
|
using GameCult.Networking;
|
|
|
|
var client = new Client
|
|
{
|
|
Logger = new FileLogger("client.log")
|
|
};
|
|
|
|
client.Connect("127.0.0.1", 3075);
|
|
```
|
|
|
|
## When To Use Something Else
|
|
|
|
If you need:
|
|
|
|
- structured events
|
|
- sinks to external observability platforms
|
|
- log scopes
|
|
- sampling and filtering pipelines
|
|
- JSON log output
|
|
|
|
use a logging framework at the application boundary.
|