Utilities

Info

desc Get/Set useful diagnostics about the system, language runtime, application and more
jar kiit.common.jar
package kiit.common.info
artifact dev.kiit:kiit-common
source folder src/lib/kotlin/slatekit-common/src/main/kotlin/slatekit/common/info
example src/lib/kotlin/slate-examples/src/main/kotlin/slatekit/examples/Example_Info.kt
dependency kiit-results


Gradle

Use the following settings in gradle for installing this component.

    
    buildscript {
        // Kotlin version currently being used
        ext.kotlin_version = '1.8.22'

        // Reference version 
        ext.kiit_version = '3.1.0'

        // ...
    }

    repositories {
        // Currently stored in Git Hub Packages.
        maven {
            url "https://maven.pkg.github.com/slatekit/kiit"
            credentials {
                username = System.getenv('GIT_PACKAGES_INSTALL_ACTOR')
                password = System.getenv('GIT_PACKAGES_INSTALL_TOKEN')
            }
        }

        // ...
    }

    dependencies {
        // Other dependencies ...
        implementation "dev.kiit:kiit-common:$kiit_version"
    }
    



Import

  
 // required 
 import kiit.common.info.About
 import kiit.common.info.Host
 import kiit.common.info.Lang
 
 
 // optional 
 import kiit.results.Try
 import kiit.results.Success


Setup

n/a


Usage

    // CASE 1: Get the host info
    val host = Host.local()
    host.each { name, value -> println( "$name : $value" ) }
    println()


    // CASE 2: Get the Lang runtime info ( java version, kotlin version etc )
    val lang = Lang.kotlin()
    lang.each { name, value -> println( "$name : $value" ) }
    println()

    // CASE 3: Set up info about your application.
    val app = About(
      area = "product1",
      name = "My sample app",
      desc = "Sample app using Slate Kit",
      company = "slatekit",
      region = "usa.ny",
      version = "1.0.1.3",
      tags = "api,slate,app",
      url = "http://products.myapp.com",
      contact = "kishore@codehelix.co",
      examples = "myapp.exe -env=dev -level=info"
    )
    app.log( { name, value -> println( "${name} : ${value}" ) } )
    


Output

  // HOST INFO
  api : KRPC1
  ip : Windows 10
  origin : local
  arch : amd64
  version : 10.0
  ext1 : C:/Users/kv/AppData/Local/Temp/

  // LANGUAGE INFO
  api : kotlin
  home : C:/Tools/Java/jdk1.8.0_91/jre
  versionNum : 2.11.7
  version : 1.8.0_91
  origin : local
  ext1 :

  // STARTUP INFO
  args : Some([Ljava.lang.String;11c20519)
  log : {app}-{env}-{date}.log
  config : {app}.config
  env : qa

  // APP INFO
  api     : My sample app
  desc     : Sample app using Slate Kit
  group    : product division
  region   : usa.ny
  url      : "http://products.myapp.com"
  contact  : kishore@codehelix.co
  version  : 1.0.1.3
  tags     : api,slate,app
  examples : myapp.exe -env=dev -level=info