Skip to content

konsnos/Simple-Logger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Logger

A simple Log system that incorporates Log Levels to select for printing. Logger is instanced and can be created with different Log Levels, while LoggerSingleton has its Log Level and can control log printing universally in the project.

Usage

Create a new Logger with

Logger _logger = new Logger(LogLevel.Debug);

and print with

_logger.LogDebug("Debug log", gameObject);

The Log Level can only be changed in the constructor of the Logger. However, the LoggerSingleton Log Level can be set at any time with

LoggerSingleton.Instance.LogLevel = LogLevel.Debug;

Setup

Requirements

  • Unity 2021.3 or later

Installation

  1. Open the Package Manager from Window > Package Manager.
  2. Click the "+" button > Add package from git URL.
  3. Enter the following URL:
https://github.com/konsnos/Simple-Logger.git?path=Assets/SimpleLogger

Alternatively, open Packages/manifest.json and add the following to the dependencies block:

{
    "dependencies": {
        "com.konsnos.simplelogger": "https://github.com/konsnos/Simple-Logger.git?path=Assets/SimpleLogger"
    }
}

Troubleshooting

In case there is confusion due to multiple Logger classes available, the following code will always select the Simple Logger

using Logger = konsnos.SimpleLogger.Logger;

Or you can type the entire namespace

konsnos.SimpleLogger.Logger _logger = new konsnos.SimpleLogger.Logger(LogLevel.Debug);

About

Simple Unity package for more control at Logs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published