Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

Android kotlin send debug log as slack message


import com.github.kittinunf.fuel.Fuel
import com.github.kittinunf.fuel.android.extension.responseJson
import org.json.JSONObject
import timber.log.Timber

object RemoteLogger {
    const val SLACK_WEBHOOK_URL = "https://hooks.slack.com/services/XXXXXXXX/XXXXXXX";
    fun sendSlackLog(message: String) {
        try {
            val json = JSONObject()
            json.put("text", message)

            Fuel.post(SLACK_WEBHOOK_URL)
                    .header("Content-type" to "application/json")
                    .body(json.toString())
                    .responseJson() { request, response, result ->
                Timber.d("Debug Slack Response ${result.toString()}")
            }

        } catch (e: Exception) {
            Timber.d("Debug Slack Error + ${e.toString()}")
        } finally {
        }
    }
}
Comment

PREVIOUS NEXT
Code Example
Java :: bigint is built in object 
Java :: with uses in python 
Java :: capitalize a letter in java 
Java :: convert jython object to java object 
Java :: java blocks 
Java :: Algorithms - count 
Java :: UIManager.setLookAndFeel Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException: Cannot invoke because "style" is null 
Java :: tipe data c++ 
Java :: List Double, fixed size 
Java :: ujava saum of positive integers 
Java :: diiferent ways to run spring boot 
Java :: How to efficiently solve the knpasack problem, in Java? 
Java :: komplettes array ausgeben java 
Java :: java backtracking 
Java :: @expose(serialize = false) not working 
Java :: Java create an object of the static class Mammal 
Java :: java this keyword 
Java :: retrofit gradle 
Java :: javalin pom 
Java :: ignore sonarlint line java 
Java :: In similar fashion we will use (RIGHT – SHIFT) to retrieve bits from val 6 at a time 
Java :: read properties file outside jar java 
Java :: java switch case enum 
Java :: ASCII PrintWriter java.io examples 
Java :: Converting data in java 
Java :: grepper editor 
Java :: java codigo para criar um aleatorio entre valores 
Java :: Java Program to illustrate the Concept of Association 
Java :: Array first Occurence 
Java :: java running sum 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =