Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: prep for release #3

Merged
merged 2 commits into from
Feb 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Chickensoft.Log.Tests/test/src/LogTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ public void Initializes() {
log.Name.ShouldBe(nameof(LogTest));
}

[Fact]
public void InitializesWithDefaults() {
var mockWriter = new Mock<ILogWriter>();
var log = new Log(nameof(LogTest));
log.ShouldBeAssignableTo<ILog>();
log.Name.ShouldBe(nameof(LogTest));
}

[Fact]
public void PrintsMessage() {
var formattedTestMsg = Format(TEST_MSG);
Expand Down
8 changes: 4 additions & 4 deletions Chickensoft.Log/Chickensoft.Log.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@
<OutputPath>./nupkg</OutputPath>
<DebugType>portable</DebugType>

<Title>Chickensoft.Log</Title>
<Title>Log</Title>
<Version>0.0.0-devbuild</Version>
<Description>Chickensoft.Log description.</Description>
<Description>Opinionated logging interface and implementations for C# applications and libraries.</Description>
<Copyright>© 2025 Chickensoft</Copyright>
<Authors>Chickensoft</Authors>
<Company>Chickensoft</Company>

<PackageId>Chickensoft.Log</PackageId>
<PackageReleaseNotes>Chickensoft.Log release.</PackageReleaseNotes>
<PackageIcon>icon.png</PackageIcon>
<PackageTags />
<PackageTags>logging;log;logger;loggers;chickensoft;util;utils</PackageTags>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageProjectUrl></PackageProjectUrl>

<RepositoryType>git</RepositoryType>
<RepositoryUrl></RepositoryUrl>
<RepositoryUrl>https://github.com/chickensoft-games/Log</RepositoryUrl>
</PropertyGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions Chickensoft.Log/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 15 additions & 2 deletions Chickensoft.Log/src/Log.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,32 @@ public sealed class Log : ILog {
public ILogFormatter Formatter { get; set; } = new LogFormatter();

/// <summary>
/// Initialize a Log that will use the provided writers.
/// Initialize a log that will use the provided writers.
/// </summary>
/// <param name="name">
/// The name associated with this log. Will be included in messages directed
/// through this log (see <see cref="Name"/>).
/// A common value is <c>nameof(EncapsulatingClass)</c>.
/// </param>
/// <param name="writers">Writers this log will use to write messages.</param>
public Log(string name, IList<ILogWriter> writers) {
public Log(string name, params ILogWriter[] writers) {
Name = name;
_writers = [.. writers];
}

/// <summary>
/// Creates a log that will output to trace by default.
/// </summary>
/// <param name="name">
/// The name associated with this log. Will be included in messages directed
/// through this log (see <see cref="Name"/>).
/// A common value is <c>nameof(EncapsulatingClass)</c>.
/// </param>
public Log(string name) {
Name = name;
_writers = [new TraceWriter()];
}

/// <inheritdoc/>
public void AddWriter(ILogWriter writer) {
lock (_writersLock) {
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Chickensoft.Log
# 🪵 Log

[![Chickensoft Badge][chickensoft-badge]][chickensoft-website]
[![Discord][discord-badge]][discord]
Expand All @@ -15,18 +15,18 @@ and libraries.
<img alt="Chickensoft.Log" src="Chickensoft.Log/icon.png" width="200">
</p>

## 🥚 Getting Started
## 📦 Installation

> [!TIP]
> For logging in Godot, see [Chickensoft.Log.Godot][log-godot].

Install the latest version of the [Chickensoft.Log] package from nuget:

```xml
<PackageReference Include="Chickensoft.Log" Version=... />
```sh
dotnet add package Chickensoft.Log
```

## 🪵 Usage
## 🌱 Usage

### Essentials

Expand Down