named-java-frames

Java Library to include text messages into stack traces

MIT License

Stars
12

named-frames

This is a tiny java library to include any text messages into Java stack traces.

For example, one needs to include the message this is my named frame into the application stacktrace. The resulting stacktrace should be the following:

    java.lang.Exception
    	at com.some.corp.something.Object.run
    	at _.this is my named frame._(JavaGeneratorTemplate.java:24)
    	at com.some.corp.something.toTheJob(SomeSource.java:50)

This is done via the following code with the library

    NamedStackFrame.global().forName("YOUR NAME").run(() -> 
            //the code is called from a method with YOUR NAME in the full name
    });

There could be a number of nice use-cases for the library, for example

  • include product version on each stack trace
  • include heavy task details into the stack
  • and much more!

For more details, see the related blog post

Dependencies

The library does not have any non-optional dependencies to allow it to be widely used without dependencies resolution hell

License

MIT License

For more details, see LICENSE.txt in the repository

Building

The project is build with gradle

Binaries

Binaries are uploaded to jcenter Gradle: just add

repositories {
  jcenter()
}

dependencies {
  compile 'org.jonnyzzz.named-frames:named-frames:<LATEST VERSION>'
}

See here for more details

Please note, the 0.1.x version is not compatible to 0.2.x version!

Note

This is my (Eugene Petrenko) private home project