Skip to content

0x100/stagelog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

StageLog

Annotated logging of the code

build

Features

  • Logging of start and/or finish of method execution
  • Tracking time spent by the method

Using

Just add the @Stagelog annotation above a method with required parameters:

@Stage(startMessage = "Initialization...", finishMessage = "Initialization finished", trackTime = true)
private void init() {
    loadConfig();
    loadData();
    applyConfig();
}

@Stage("Load config")
private void loadConfig() {
    // ...
    sleep(100);
}

@Stage(trackTime = true)
private void loadData() {
    // ...
    sleep(200);
}

@Stage(startMessage = "Apply config")
private void applyConfig() {
    // ...
    sleep(300);
}

Then build your app.

Result output:

Initialization...
Load config
Example.loadData()...
Example.loadData() finished in 00:00:00.206
Apply config
Initialization finished in 00:00:00.617

How to add it in your project

Maven

  1. Add the jitpack repository in your pom.xml

    <repositories>
        <repository>
            <id>jitpack.io</id>
            <url>https://jitpack.io</url>
        </repository>
    </repositories>
  2. Add the stagelog dependency

    <dependency>
        <groupId>com.github.0x100</groupId>
        <artifactId>stagelog</artifactId>
        <version>master-SNAPSHOT</version>
    </dependency>

Gradle

  1. Add the jitpack repository in your root build.gradle at the end of repositories:

    allprojects {
        repositories {
            // ...
            maven { url 'https://jitpack.io' }
        }
    }
  2. Add the dependency

    dependencies {
        implementation 'com.github.0x100:stagelog:master-SNAPSHOT'
    }

Examples

See examples in the code.

How to contribute

Fork the repository, make changes, write a test for your code, send me a pull request. I will review your changes and apply them to the master branch shortly, provided they don't violate quality standards. To avoid frustration, before sending a pull request please run the Maven build:

$ mvn clean package

Good luck and have fun!

About

Annotated logging of the code

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages