Colorful Logger Lib

Quick rating

Colorful Logger Lib

No reviews yet

This library is designed to simplify a specific aspect of Minecraft Modding workflows by making it easy to add ANSI color to your Logger calls.

API/Library
Mod Loaders
Fabric
Minecraft

Community voices

Reviews

Versions
Loading versions…
Match includes

Click once to include, again to exclude, again to clear

Rating Any
Any 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0
Min
Max
Play Status
Reviews
Time Played
hrs+
Verified developers only
Has developer response
List view
Grid view
Compact view
Sort by
Date
Rating
Helpful
Unhelpful
Edited
Sort ascending
Delete this review?

This removes your review from the project. You can write a new review after.

Review submitted for moderation

Your review has been sent to moderators, who will check that it meets our guidelines before it appears publicly.

No reviews yet. Be the first to review this project!

Get it on

Available Platforms

Compatibility

Supported Environments

Where It Runs
Unknown

The author has not specified where this runs.

About

Project Details

Type
Mod
License
Creative Commons Zero v1.0 Universal
Latest Version
2.2.1
Authors

For authors

Embed Badge

If you're the author of this project, you can embed a live badge anywhere that supports HTML or Markdown. It updates automatically whenever ratings change.

Custom banner text
ModDex rating badge preview

Use HTML for any page that supports it, or Markdown for README files and Markdown-based descriptions.

Identifiers

Platform IDs

Modrinth ID

Resources

External Links

Source Issues Wiki Discord

About

Description

banner



github-buttons-kofi-trans.png?v15-08-2024 github-buttons-modrinth-trans.png?v15-08-2024



Ever wanted to add some color to your LOGGER during the development of your minecraft mods in a simple, yet functional manner?

Well look no further, Handsome Steve has you covered! This simple library allows you to do just that by utilizing a wide range of pre-defined ANSI codes.

EDIT: Please prioritize the Handsome Steve Maven as this also serves the Jar's Sources file. Alternatively, the installation code below has been updated to reflect Modrinth Maven incase the maven is ever offline, apologies in for any inconveniences.

FAQ

Q: Is this a mod?
Techinally, no. This is a library, so it's only really used when developing a mod, however, it may be required as a dependency when the dependent mod is being installed on a client/server depending on what platform the dependent mod is targeting and how the mod developer is utilising the library.

Q: Can I use this library as a dependency in my project?
Absolutely, go nuts!

Q: Does this library require a specific Fabric Version?
Nope, it's now standalone, so as long as your modding platform uses org.slf4j.Logger, it will work regardless of the version.

Current Version

Please note that the current version only has the Logger.info() method colorized, the rest will be added in future updates, such as Logger.error() etc.

Installation

Add the required Maven Repositories to your build.gradle in the repositories section:

    repositories {
        // Initial Maven Repository
        // Priority
        exclusiveContent {
            forRepository {
                maven {
                    name = "Handsome Steve's Maven"
                    url = "https://maven.handsomesteve.net/releases"
                }
            }
            filter {
                includeGroup "net.handsomesteve"
            }
        }
        
        // Modrinth Fallback Maven
        // Optional, but strongly recommended
        exclusiveContent {
            forRepository {
                maven {
                    name = "Modrinth"
                    url = "https://api.modrinth.com/maven"
                }
            }
            filter {
                includeGroup "maven.modrinth"
            }
        }
    }


Add an implementation to your build.gradle in the dependencies section:

    dependencies {
        //Handsome Steve's Colorful Logger // This automatically downloads the sources file as well.
        implementation include("net.handsomesteve:colorfulloggerlib:${project.hs_colorful_logger}")
        
        // Modrinth Fallback (De-comment if preferred maven is down).
        //implementation include ("maven.modrinth:colorfulloggerlib:${project.hs_colorful_logger}")
        // SOURCES FILE NEEDS MANUAL DOWNLOAD, SEE BOTTOM OF PAGE (if using fallback maven).
    }


Add the version variable to your gradle.properties and replace {version} by the desired available library version of your choice:

    hs_colorful_logger={version}

Implementation

Create a public static final instance of the ColorfulLogger class. This instance will allow you to utilize the internal reference of org.slf4j.Logger from the ColorfulLogger class throughout your project.

    import net.handsomesteve.api.ColorfulLogger;
    import net.handsomesteve.api.ansi.AnsiColorBackground;
    import net.handsomesteve.api.ansi.AnsiColorText;
    
    public class FabricMod implements ModInitializer {
        public static final String MOD_ID = "your-mod-id";
        public static final ColorfulLogger LOGGER = ColorfulLogger.getInstance("your-mod-id", false);
 
       @Override
       public void onInitialize() {
           LOGGER.info(">>> This is a plain message without any colouring");
           LOGGER.info(">>> I want some green text", AnsiColorText.ANSI_BRIGHT_GREEN);
           LOGGER.info(">>> I want some red text with a black background", AnsiColorText.ANSI_BRIGHT_RED, AnsiColorBackground.ANSI_BLACK_BACK);
       }
    }

If required, the `Logger` can be interfaced with by calling it as follows:

    LOGGER.getLogger(); // Returns the Logger to be interfaced with.

This will, however, not implement the ANSI color coding to your output if accessed this way.

NOTE: A ColorfulLogger variable can be declared anywhere in the project. It is recommended, however, to only ever declare this once as it is a singleton.

To import the declared variable as a static import when referencing the variable:

import static com.packagename.FabricMod.LOGGER;

ALTERNATIVELY: ColorfulLogger can be instantiated anywhere in the project as follows if required after the singleton is declared:

public class References {
      private static final ColorfulLogger LOGGER = ColorfulLogger.getInstance();

      public static ColorfulLogger getLogger() {
          return LOGGER;
      }
}

Then accessed:

import static com.package.References.getLogger;

public class MyClass {
      References.getLogger();
}

Sources

[Only if using Modrinth Maven as a dependency]

There is a sources file available in the versions download.

This is a well define sources file where all variables, methods and constructors are well-defined as well as the class itself. You should download and add this file in the folder path:

.gradle/loom-cache/remapped_mods/net_fabricmc_yarn{version}/maven/colorfulloggerlib/{hs_colorful_logger_version}/

Note: Replace curly-braced text with current versions etc.

Screenshots

Gallery

  • Colorful Outputs on that Logger <3
    Colorful Outputs on that Logger <3 Now I'm not going to lie, this makes my modding experience 1000% better, there's nothing more that I look forward to than hitting that [Play] button and seeing my sweet sweet output!

Versions

Files

Relations

Project Relations

More like this

Similar Mods

Suggestions use data such as tags, dependencies, dependents, descriptions, titles, and more to rank how much they overlap with this mod.

On ModDex

Community snapshot

0
Ratings
0
Followers
0
In stacks

By the numbers

Statistics

<1,000
Downloads
Last Updated
CurseForge
Created
Last synced
When ModDex last fetched this project from CurseForge or Modrinth. Every project is re-checked on a schedule, and any project that ships a new file is synced automatically within hours of the release.
New file updates sync automatically
How syncing works