Skip to content

Commit

Permalink
Logger 1.0.0.0 Release
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffpatton1971 committed Jan 5, 2024
1 parent 9b6b023 commit 36d5b1c
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 35 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
| Latest Version | Nuget.org | Issues | License | Discord |
|-----------------|----------------|----------------|----------------|----------------|
| [![Latest Version](https://img.shields.io/github/v/tag/mod-posh/Logger)](https://github.com/mod-posh/Logger/tags) | [![Nuget.org](https://img.shields.io/nuget/dt/Logger)](https://www.nuget.org/packages/Logger) | [![GitHub issues](https://img.shields.io/github/issues/mod-posh/Logger)](https://github.com/mod-posh/Logger/issues) | [![GitHub license](https://img.shields.io/github/license/mod-posh/Logger)](https://github.com/mod-posh/Logger/blob/master/LICENSE) | [![Discord Server](https://assets-global.website-files.com/6257adef93867e50d84d30e2/636e0b5493894cf60b300587_full_logo_white_RGB.svg)](https://discord.com/channels/1044305359021555793/1044305781627035811) |
# ModPosh.Logger

`ModPosh.Logger` is a versatile logging library for C# projects and PowerShell scripts/modules. It provides functionality for logging messages to the console or a file, supporting custom configuration and log rotation.

## Code Documentation

Detailed documentation can be found in the [docs](docs\index.md) folder.

## Features

- Log messages to the console or file.
Expand Down
17 changes: 17 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Version 1.0.0.0 of Logger

This should be a usable logger in both C# and PowerShell, which I've struggled with lately. It should be simple and allow logging to a file or the console if needed.

## DOCUMENTATION

* Add Documentation #5

## ENHANCEMENT

* Update Psake for use with C# Projects #6
* Add Documentation #5
* Create Factory #4
* Add Testing Framework #3
* Add the ability to handle log rotation #2
* Add the ability to use a configuration file #1

Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#### [Logger](index.md 'index')

### [ModPosh.Logger.Factory](ModPosh.Logger.Factory.md 'ModPosh.Logger.Factory').[LoggerFactory](ModPosh.Logger.Factory.LoggerFactory.md 'ModPosh.Logger.Factory.LoggerFactory')

## LoggerFactory.CreateConsoleLogger() Method
Expand All @@ -11,10 +10,8 @@ public static ModPosh.Logger.Implementations.Logger CreateConsoleLogger();
```

#### Returns

[Logger](ModPosh.Logger.Implementations.Logger.md 'ModPosh.Logger.Implementations.Logger')
[Logger](ModPosh.Logger.Implementations.Logger.md 'ModPosh.Logger.Implementations.Logger')
An instance of Logger configured to log messages to the console.

### Remarks

This method creates a Logger instance with default settings where logging to the console is enabled.
This method creates a Logger instance with default settings where logging to the console is enabled.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#### [Logger](index.md 'index')

### [ModPosh.Logger.Factory](ModPosh.Logger.Factory.md 'ModPosh.Logger.Factory').[LoggerFactory](ModPosh.Logger.Factory.LoggerFactory.md 'ModPosh.Logger.Factory.LoggerFactory')

## LoggerFactory.CreateFileLogger(string) Method
Expand All @@ -9,18 +8,15 @@ Creates a Logger instance that logs messages to a specified file.
```csharp
public static ModPosh.Logger.Implementations.Logger CreateFileLogger(string Path);
```

#### Parameters

<a name='ModPosh.Logger.Factory.LoggerFactory.CreateFileLogger(string).Path'></a>

`Path` [System.String](https://docs.microsoft.com/en-us/dotnet/api/System.String 'System.String')

#### Returns

[Logger](ModPosh.Logger.Implementations.Logger.md 'ModPosh.Logger.Implementations.Logger')
[Logger](ModPosh.Logger.Implementations.Logger.md 'ModPosh.Logger.Implementations.Logger')
An instance of Logger configured to log messages to the specified file.

### Remarks

This method creates a Logger instance that writes log messages to the file located at the provided path.
This method creates a Logger instance that writes log messages to the file located at the provided path.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#### [Logger](index.md 'index')

### [ModPosh.Logger.Factory](ModPosh.Logger.Factory.md 'ModPosh.Logger.Factory').[LoggerFactory](ModPosh.Logger.Factory.LoggerFactory.md 'ModPosh.Logger.Factory.LoggerFactory')

## LoggerFactory.CreateLogger(string) Method
Expand All @@ -9,7 +8,6 @@ Creates a Logger instance using configuration settings from a specified file pat
```csharp
public static ModPosh.Logger.Implementations.Logger CreateLogger(string configFilePath);
```

#### Parameters

<a name='ModPosh.Logger.Factory.LoggerFactory.CreateLogger(string).configFilePath'></a>
Expand All @@ -19,10 +17,8 @@ public static ModPosh.Logger.Implementations.Logger CreateLogger(string configFi
The file path to the configuration file.

#### Returns

[Logger](ModPosh.Logger.Implementations.Logger.md 'ModPosh.Logger.Implementations.Logger')
[Logger](ModPosh.Logger.Implementations.Logger.md 'ModPosh.Logger.Implementations.Logger')
An instance of Logger configured based on the specified configuration file.

### Remarks

This method reads configuration settings from the provided file path and initializes a new Logger instance with these settings.
This method reads configuration settings from the provided file path and initializes a new Logger instance with these settings.
1 change: 0 additions & 1 deletion docs/ModPosh.Logger.Factory.LoggerFactory.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#### [Logger](index.md 'index')

### [ModPosh.Logger.Factory](ModPosh.Logger.Factory.md 'ModPosh.Logger.Factory')

## LoggerFactory Class
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#### [Logger](index.md 'index')

### [ModPosh.Logger.Implementations](ModPosh.Logger.Implementations.md 'ModPosh.Logger.Implementations').[ConfigurationReader](ModPosh.Logger.Implementations.ConfigurationReader.md 'ModPosh.Logger.Implementations.ConfigurationReader')

## ConfigurationReader.ReadConfiguration(string) Method
Expand All @@ -9,7 +8,6 @@ Reads the logger configuration from a specified JSON file.
```csharp
public ModPosh.Logger.Models.LoggerConfig ReadConfiguration(string path);
```

#### Parameters

<a name='ModPosh.Logger.Implementations.ConfigurationReader.ReadConfiguration(string).path'></a>
Expand All @@ -21,21 +19,19 @@ The file path of the JSON configuration file.
Implements [ReadConfiguration(string)](ModPosh.Logger.Interfaces.IConfigurationReader.ReadConfiguration(string).md 'ModPosh.Logger.Interfaces.IConfigurationReader.ReadConfiguration(string)')

#### Returns

[LoggerConfig](ModPosh.Logger.Models.LoggerConfig.md 'ModPosh.Logger.Models.LoggerConfig')
[LoggerConfig](ModPosh.Logger.Models.LoggerConfig.md 'ModPosh.Logger.Models.LoggerConfig')
A [LoggerConfig](ModPosh.Logger.Models.LoggerConfig.md 'ModPosh.Logger.Models.LoggerConfig') object populated with settings from the file.

#### Exceptions

[System.IO.FileNotFoundException](https://docs.microsoft.com/en-us/dotnet/api/System.IO.FileNotFoundException 'System.IO.FileNotFoundException')
[System.IO.FileNotFoundException](https://docs.microsoft.com/en-us/dotnet/api/System.IO.FileNotFoundException 'System.IO.FileNotFoundException')
Thrown when the specified file is not found.

[System.Text.Json.JsonException](https://docs.microsoft.com/en-us/dotnet/api/System.Text.Json.JsonException 'System.Text.Json.JsonException')
[System.Text.Json.JsonException](https://docs.microsoft.com/en-us/dotnet/api/System.Text.Json.JsonException 'System.Text.Json.JsonException')
Thrown when the file content is not a valid JSON or cannot be deserialized into a LoggerConfig object.

[System.Exception](https://docs.microsoft.com/en-us/dotnet/api/System.Exception 'System.Exception')
[System.Exception](https://docs.microsoft.com/en-us/dotnet/api/System.Exception 'System.Exception')
Throws a general exception with a message indicating the error encountered during the reading process.

### Remarks

If the file is not found or if the JSON content is invalid, this method returns a default LoggerConfig object with logging enabled to console only.
If the file is not found or if the JSON content is invalid, this method returns a default LoggerConfig object with logging enabled to console only.
1 change: 0 additions & 1 deletion docs/ModPosh.Logger.Implementations.ConfigurationReader.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#### [Logger](index.md 'index')

### [ModPosh.Logger.Implementations](ModPosh.Logger.Implementations.md 'ModPosh.Logger.Implementations')

## ConfigurationReader Class
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#### [Logger](index.md 'index')

### [ModPosh.Logger.Implementations](ModPosh.Logger.Implementations.md 'ModPosh.Logger.Implementations').[Logger](ModPosh.Logger.Implementations.Logger.md 'ModPosh.Logger.Implementations.Logger')

## Logger.CheckAndRotateLogFile() Method
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#### [Logger](index.md 'index')

### [ModPosh.Logger.Implementations](ModPosh.Logger.Implementations.md 'ModPosh.Logger.Implementations').[Logger](ModPosh.Logger.Implementations.Logger.md 'ModPosh.Logger.Implementations.Logger')

## Logger.Log(string, string) Method
Expand All @@ -9,7 +8,6 @@ Logs a message with the specified message type.
```csharp
private void Log(string message, string messageType);
```

#### Parameters

<a name='ModPosh.Logger.Implementations.Logger.Log(string,string).message'></a>
Expand All @@ -22,4 +20,4 @@ The message to log.

`messageType` [System.String](https://docs.microsoft.com/en-us/dotnet/api/System.String 'System.String')

The type of message (e.g., "INFO", "WARNING", "ERROR").
The type of message (e.g., "INFO", "WARNING", "ERROR").
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#### [Logger](index.md 'index')

### [ModPosh.Logger.Implementations](ModPosh.Logger.Implementations.md 'ModPosh.Logger.Implementations').[Logger](ModPosh.Logger.Implementations.Logger.md 'ModPosh.Logger.Implementations.Logger')

## Logger.LogError(string) Method
Expand All @@ -9,7 +8,6 @@ Logs an error message.
```csharp
public void LogError(string message);
```

#### Parameters

<a name='ModPosh.Logger.Implementations.Logger.LogError(string).message'></a>
Expand All @@ -18,4 +16,4 @@ public void LogError(string message);

The error message to log.

Implements [LogError(string)](ModPosh.Logger.Interfaces.ILogger.LogError(string).md 'ModPosh.Logger.Interfaces.ILogger.LogError(string)')
Implements [LogError(string)](ModPosh.Logger.Interfaces.ILogger.LogError(string).md 'ModPosh.Logger.Interfaces.ILogger.LogError(string)')

0 comments on commit 36d5b1c

Please sign in to comment.