{"id":3015,"date":"2024-01-31T10:00:00","date_gmt":"2024-01-31T10:00:00","guid":{"rendered":"https:\/\/www.infobip.com\/developers\/?p=3015"},"modified":"2024-01-30T15:01:30","modified_gmt":"2024-01-30T15:01:30","slug":"custom-mobile-logging-using-infobip-api-go-sdk-and-zerolog","status":"publish","type":"post","link":"https:\/\/www.infobip.com\/developers\/blog\/custom-mobile-logging-using-infobip-api-go-sdk-and-zerolog","title":{"rendered":"Custom Mobile logging using Infobip API Go SDK and zerolog"},"content":{"rendered":"\n<p>This article will show you how to use the <a href=\"https:\/\/github.com\/rs\/zerolog\">zerolog-sms<\/a> logger, a logging library\nthat allows you to send special log entries over SMS in your Go projects. We will also show how we added SMS\ncapabilities through a custom <code>Mobile<\/code> logging level to the original <a href=\"https:\/\/github.com\/rs\/zerolog\">zerolog<\/a>, a popular\nlogging library for Golang.<\/p>\n\n\n\n<p>Sometimes, we want to be notified about a system&#8217;s status when something extraordinary happens, even if we are not close\nto a computer. The event could be some update on the progress of a long process or a terrible error that needs\nattention. For that, a sophisticated monitoring and alerting system like OpsGenie is usually employed. But you may need\na simple way to get notifications on your phone without the hassle of configuring complicated tools. For that, you can\nintegrate communication channels like SMS or WhatsApp into any program through the Infobip API and its SDKs with only a\nfew lines of code!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"prerequisites\">Prerequisites<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Working Go installation<\/li>\n\n\n\n<li>Infobip Account<\/li>\n\n\n\n<li>Git installation<\/li>\n\n\n\n<li>An IDE or Terminal<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"project-overview\">Project Overview<\/h2>\n\n\n\n<p>To use the SMS-enabled features of our zerolog version, follow the following steps:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Create a new Go project.<\/li>\n\n\n\n<li>Clone our zerolog-sms repo.<\/li>\n\n\n\n<li>Get zerolog and <code>replace<\/code> it with the local version.<\/li>\n\n\n\n<li>Call the <code>Alert()<\/code> function with your event message.<\/li>\n<\/ol>\n\n\n\n<p>This demo uses a fork of the official zerolog repository, in which we included a few extra lines of code that do the\nfollowing:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Add a <code>Mobile<\/code> logging level<\/li>\n\n\n\n<li>Add an <code>Alert()<\/code> convenience function to log to the Mobile level<\/li>\n\n\n\n<li>Add the Infobip dependencies and create a <code>sendSMS<\/code> function to write events.<\/li>\n<\/ol>\n\n\n\n<p>Now, let&#8217;s go through the steps to get your code running!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"create-a-new-go-project\">Create a new Go project<\/h2>\n\n\n\n<p>For this step, you can use the terminal or an IDE, as you prefer. You need to <a href=\"https:\/\/go.dev\/doc\/code\">create a module<\/a>\nto manage dependencies.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"clone-our-zerolog-sms-repo\">Clone our zerolog-sms repo.<\/h2>\n\n\n\n<p>Get a copy of our SMS-enabled zerolog by cloning the repo somewhere outside your project folder.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>git clone https:\/\/github.com\/infobip-community\/zerolog-sms.git<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"get-zerolog-and-replace-it-with-the-local-version\">Get zerolog and <code>replace<\/code> it with the local version<\/h2>\n\n\n\n<p>Install zerolog as you would with a regular dependency:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>go get -u github.com\/rs\/zerolog\/log<\/code><\/pre>\n\n\n\n<p>To use the local zerolog dependency instead of the one from GitHub, you need a <code>replace<\/code> line in your project&#8217;s <code>go.mod<\/code>\nfile. The path on the right should point to wherever you cloned the zerolog-sms repo. Here&#8217;s an example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>replace github.com\/rs\/zerolog v1.31.0 => ..\/..\/Projects\/zerolog-sms<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"call-the-alert-function-with-your-event-message\">Call the <code>Alert()<\/code> function with your event message<\/h2>\n\n\n\n<p>For the following Go code to run correctly, you must first set three environment variables: IB_BASE_URL, IB_API_KEY, and\nSMS_DESTINATION with your base URL, credentials, and phone number in international format, respectively.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>export IB_BASE_URL=\"&lt;your-base-url>\"\nexport IB_API_KEY=\"&lt;your-api-key>\"\nexport SMS_DESTINATION=\"&lt;your-phone-number>\"<\/code><\/pre>\n\n\n\n<p>The base URL and API keys are created when you <a href=\"https:\/\/www.infobip.com\/signup\">sign up<\/a>. You can check them by logging\nin to <a href=\"https:\/\/portal.infobip.com\/\">your account<\/a>. You can set these variables however your existing project sets\nenvironment variables.<\/p>\n\n\n\n<p>Now, you can call the newly added function <code>Alert()<\/code> from your project and see the desired log entry directly on your\nphone.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>func main() {\n    zerolog.TimeFieldFormat = zerolog.TimeFormatUnix\n\n    log.Alert(\"Hello, alert over SMS\")\n}<\/code><\/pre>\n\n\n\n<p>And that&#8217;s all you need to use this SMS logging functionality. Read on to see how it works.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>Now, we&#8217;ll describe the steps to add the SMS capabilities to zerolog.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"add-a-mobile-logging-level\">Add a <code>Mobile<\/code> logging level<\/h2>\n\n\n\n<p>First, we enabled a new logging level that will send SMS messages when used.\nThis code goes under the root <code>log.go<\/code> file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const (\n    \/\/ ...\n    \/\/ MobileLevel defines a mobile log level.\n    MobileLevel<\/code><\/pre>\n\n\n\n<p>This also requires adding a function that returns a new <code>Mobile<\/code> event under the same <code>log.go<\/code> file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Mobile starts a new message with Mobile level.\n\/\/\n\/\/ You must call Msg on the returned event in order to send the event.\nfunc (l *Logger) Mobile() *Event {\n    return l.newEvent(MobileLevel, nil)\n}<\/code><\/pre>\n\n\n\n<p>Additionally, for the log level to display correctly, we need to add a value with the name of the logging level under\nthe root <code>globals.go<\/code> file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>var(\n   \/\/ ..\n   LevelMobileValue = \"mobile\"<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"add-an-alert-convenience-function-to-log-to-the-mobile-level\">Add an <code>Alert()<\/code> convenience function to log to the Mobile level<\/h2>\n\n\n\n<p>After the new logging level was added, we created a function that the user can use. This also goes under the\nroot <code>log.go<\/code> file.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Alert sends a log event using mobile level and no extra field.\n\/\/ Arguments are handled in the manner of fmt.Print.\nfunc (l *Logger) Alert(v ...interface{}) {\n    if e := l.Mobile(); e.Enabled() {\n        e.CallerSkipFrame(1).Msg(fmt.Sprint(v...))\n    }\n}<\/code><\/pre>\n\n\n\n<p>This one also needs to be implemented in the <code>log\/log.go<\/code> file, like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Alert sends a log event using MobileLevel level and no extra field.\n\/\/ Arguments are handled in the manner of fmt.Print.\nfunc Alert(v ...interface{}) {\n    Logger.Mobile().CallerSkipFrame(1).Msg(fmt.Sprint(v...))\n}<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"add-the-infobip-dependencies-and-create-a-sendsms-function-to-write-events\">Add the Infobip dependencies and create a <code>sendSMS<\/code> function to write events<\/h2>\n\n\n\n<p>Under the file <code>event.go<\/code>, we added the dependency to use the <a href=\"https:\/\/github.com\/infobip-community\/infobip-api-go-sdk\">Infobip API Go SDK<\/a>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>    \"github.com\/infobip-community\/infobip-api-go-sdk\/v3\/pkg\/infobip\"\n    \"github.com\/infobip-community\/infobip-api-go-sdk\/v3\/pkg\/infobip\/models\"<\/code><\/pre>\n\n\n\n<p>Then, we created a function to send an SMS to <code>SMS_DESTINATION<\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>func sendSMS(msg string) {\n    client, _ := infobip.NewClientFromEnv()\n\n    destination := os.Getenv(\"SMS_DESTINATION\")\n\n    sms := models.SMSMsg{\n    Destinations: &#91;]models.SMSDestination{\n            {\n                To: destination},\n            },\n            Text: msg,\n        }\n        request := models.SendSMSRequest{\n        Messages: &#91;]models.SMSMsg{sms},\n    }\n\n    resp, respDetails, _ := client.SMS.Send(context.Background(), request)\n\n    fmt.Println(msg)\n    fmt.Println(resp)\n    fmt.Println(respDetails)\n}<\/code><\/pre>\n\n\n\n<p>In this function, we make use of the <code>SMS_DESTINATION<\/code> variable we set in the previous instructions. The other\ntwo, <code>IB_API_KEY<\/code> and <code>IB_BASE_URL<\/code>, are read directly from the SDK in the <code>NewClientFromEnv<\/code> function. The next steps\nare creating an <code>SMSMessage<\/code> and sending it through the <code>SMS.Send<\/code> function.<\/p>\n\n\n\n<p>The last step is to call the <code>sendSms<\/code> function when writing the event.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>func (e *Event) write() (err error) {\n    if e == nil {\n        return nil\n    }\n    if e.level != Disabled {\n        e.buf = enc.AppendEndMarker(e.buf)\n        e.buf = enc.AppendLineBreak(e.buf)\n        if e.w != nil {\n            _, err = e.w.WriteLevel(e.level, e.buf)\n        }\n\n        if e.level == MobileLevel {\n            sendSms(string(e.buf))\n        }\n    }\n    putEvent(e)\n    return\n}<\/code><\/pre>\n\n\n\n<p>Here, we use the <code>write<\/code> function of <code>Event<\/code>, which is used by all logging levels, to add an extra action for the \nparticular <code>MobileLevel<\/code>.<\/p>\n\n\n\n<p>That is all! As you can see, with a few steps, you could adapt the steps we took with zerolog if you wanted to modify\nany other logger and get notified about important things on your phone. To get a complete overview of all the required\nchanges, check our <a href=\"https:\/\/github.com\/infobip-community\/zerolog-sms\">zerolog fork<\/a> last changes.<\/p>\n\n\n\n<p>In case you find any errors or you want to know more about response details, please check Infobip\n<a href=\"https:\/\/www.infobip.com\/docs\/essentials\/response-status-and-error-codes\">Response Status and Error Codes Reference<\/a>.\nGo errors can be caught by enabling the anonymous variables <code>_<\/code> through code and checking if they are <code>nil<\/code> or\nan <code>Error<\/code> object. To do this in the <code>sendSms<\/code> function, replace <code>_<\/code> with <code>err<\/code> and check the <code>err<\/code> variable value after\nthat. For more, check the <a href=\"https:\/\/go.dev\/blog\/error-handling-and-go\">Error handling and Go<\/a> guide from the Golang blog.<\/p>\n\n\n\n<p>For a comprehensive guide on sending SMS, be sure to check the documentation page for <a href=\"https:\/\/www.infobip.com\/docs\/api\/channels\/sms\/sms-messaging\/outbound-sms\/send-sms-message\">sending SMS<\/a> messages.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This article will show you how to use the [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":3017,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","footnotes":""},"categories":[272],"tags":[46],"coauthors":[156],"class_list":["post-3015","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-use-case","tag-developer-docs"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Custom Mobile logging using Infobip API Go SDK and zerolog - Infobip Developers Hub<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.infobip.com\/developers\/blog\/custom-mobile-logging-using-infobip-api-go-sdk-and-zerolog\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Custom Mobile logging using Infobip API Go SDK and zerolog - Infobip Developers Hub\" \/>\n<meta property=\"og:description\" content=\"This article will show you how to use the [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.infobip.com\/developers\/blog\/custom-mobile-logging-using-infobip-api-go-sdk-and-zerolog\" \/>\n<meta property=\"og:site_name\" content=\"Infobip Developers Hub\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/infobip\/\" \/>\n<meta property=\"article:published_time\" content=\"2024-01-31T10:00:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.infobip.com\/developers\/wp-content\/uploads\/2024\/01\/joel-jasmin-forestbird-Kfy_FwhfPlc-unsplash-scaled.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"2560\" \/>\n\t<meta property=\"og:image:height\" content=\"1707\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Erick Corona\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@InfobipDev\" \/>\n<meta name=\"twitter:site\" content=\"@InfobipDev\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Erick Corona\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.infobip.com\/developers\/blog\/custom-mobile-logging-using-infobip-api-go-sdk-and-zerolog#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.infobip.com\/developers\/blog\/custom-mobile-logging-using-infobip-api-go-sdk-and-zerolog\"},\"author\":{\"name\":\"Erick Corona\",\"@id\":\"https:\/\/www.infobip.com\/developers\/#\/schema\/person\/9e52e4d22fb53cc9a87adc54825c5e5c\"},\"headline\":\"Custom Mobile logging using Infobip API Go SDK and zerolog\",\"datePublished\":\"2024-01-31T10:00:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.infobip.com\/developers\/blog\/custom-mobile-logging-using-infobip-api-go-sdk-and-zerolog\"},\"wordCount\":868,\"publisher\":{\"@id\":\"https:\/\/www.infobip.com\/developers\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.infobip.com\/developers\/blog\/custom-mobile-logging-using-infobip-api-go-sdk-and-zerolog#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.infobip.com\/developers\/wp-content\/uploads\/2024\/01\/joel-jasmin-forestbird-Kfy_FwhfPlc-unsplash-scaled.jpg\",\"keywords\":[\"developer docs\"],\"articleSection\":[\"Use Case\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.infobip.com\/developers\/blog\/custom-mobile-logging-using-infobip-api-go-sdk-and-zerolog\",\"url\":\"https:\/\/www.infobip.com\/developers\/blog\/custom-mobile-logging-using-infobip-api-go-sdk-and-zerolog\",\"name\":\"Custom Mobile logging using Infobip API Go SDK and zerolog - Infobip Developers Hub\",\"isPartOf\":{\"@id\":\"https:\/\/www.infobip.com\/developers\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.infobip.com\/developers\/blog\/custom-mobile-logging-using-infobip-api-go-sdk-and-zerolog#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.infobip.com\/developers\/blog\/custom-mobile-logging-using-infobip-api-go-sdk-and-zerolog#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.infobip.com\/developers\/wp-content\/uploads\/2024\/01\/joel-jasmin-forestbird-Kfy_FwhfPlc-unsplash-scaled.jpg\",\"datePublished\":\"2024-01-31T10:00:00+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.infobip.com\/developers\/blog\/custom-mobile-logging-using-infobip-api-go-sdk-and-zerolog#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.infobip.com\/developers\/blog\/custom-mobile-logging-using-infobip-api-go-sdk-and-zerolog\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.infobip.com\/developers\/blog\/custom-mobile-logging-using-infobip-api-go-sdk-and-zerolog#primaryimage\",\"url\":\"https:\/\/www.infobip.com\/developers\/wp-content\/uploads\/2024\/01\/joel-jasmin-forestbird-Kfy_FwhfPlc-unsplash-scaled.jpg\",\"contentUrl\":\"https:\/\/www.infobip.com\/developers\/wp-content\/uploads\/2024\/01\/joel-jasmin-forestbird-Kfy_FwhfPlc-unsplash-scaled.jpg\",\"width\":2560,\"height\":1707},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.infobip.com\/developers\/blog\/custom-mobile-logging-using-infobip-api-go-sdk-and-zerolog#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.infobip.com\/developers\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Custom Mobile logging using Infobip API Go SDK and zerolog\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.infobip.com\/developers\/#website\",\"url\":\"https:\/\/www.infobip.com\/developers\/\",\"name\":\"Infobip Developers Hub\",\"description\":\"Build meaningful customer relationships across any channel\",\"publisher\":{\"@id\":\"https:\/\/www.infobip.com\/developers\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.infobip.com\/developers\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.infobip.com\/developers\/#organization\",\"name\":\"Infobip Developers Hub\",\"url\":\"https:\/\/www.infobip.com\/developers\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.infobip.com\/developers\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.infobip.com\/developers\/wp-content\/uploads\/2023\/03\/Infobip_logo_favicon.png\",\"contentUrl\":\"https:\/\/www.infobip.com\/developers\/wp-content\/uploads\/2023\/03\/Infobip_logo_favicon.png\",\"width\":696,\"height\":696,\"caption\":\"Infobip Developers Hub\"},\"image\":{\"@id\":\"https:\/\/www.infobip.com\/developers\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/infobip\/\",\"https:\/\/x.com\/InfobipDev\",\"https:\/\/www.youtube.com\/channel\/UCUPSTy53VecI5GIir3J3ZbQ\",\"https:\/\/github.com\/infobip-community\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.infobip.com\/developers\/#\/schema\/person\/9e52e4d22fb53cc9a87adc54825c5e5c\",\"name\":\"Erick Corona\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.infobip.com\/developers\/#\/schema\/person\/image\/1d096b53aac31da0002a2066ab28c0f1\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/c59cdedbf2c066d0ebbb15c5b1da56b1c5b5e7c49e3c4aaf7410dd1462a7b74c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/c59cdedbf2c066d0ebbb15c5b1da56b1c5b5e7c49e3c4aaf7410dd1462a7b74c?s=96&d=mm&r=g\",\"caption\":\"Erick Corona\"},\"description\":\"Erick has been in the software industry for more than 10 years. Currently, he works as a Developer Experience Engineer at Infobip. He's interested in software development, writing, and racing car simulators in his free time.\",\"url\":\"https:\/\/www.infobip.com\/developers\/blog\/author\/erick\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Custom Mobile logging using Infobip API Go SDK and zerolog - Infobip Developers Hub","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.infobip.com\/developers\/blog\/custom-mobile-logging-using-infobip-api-go-sdk-and-zerolog","og_locale":"en_US","og_type":"article","og_title":"Custom Mobile logging using Infobip API Go SDK and zerolog - Infobip Developers Hub","og_description":"This article will show you how to use the [&hellip;]","og_url":"https:\/\/www.infobip.com\/developers\/blog\/custom-mobile-logging-using-infobip-api-go-sdk-and-zerolog","og_site_name":"Infobip Developers Hub","article_publisher":"https:\/\/www.facebook.com\/infobip\/","article_published_time":"2024-01-31T10:00:00+00:00","og_image":[{"width":2560,"height":1707,"url":"https:\/\/www.infobip.com\/developers\/wp-content\/uploads\/2024\/01\/joel-jasmin-forestbird-Kfy_FwhfPlc-unsplash-scaled.jpg","type":"image\/jpeg"}],"author":"Erick Corona","twitter_card":"summary_large_image","twitter_creator":"@InfobipDev","twitter_site":"@InfobipDev","twitter_misc":{"Written by":"Erick Corona","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.infobip.com\/developers\/blog\/custom-mobile-logging-using-infobip-api-go-sdk-and-zerolog#article","isPartOf":{"@id":"https:\/\/www.infobip.com\/developers\/blog\/custom-mobile-logging-using-infobip-api-go-sdk-and-zerolog"},"author":{"name":"Erick Corona","@id":"https:\/\/www.infobip.com\/developers\/#\/schema\/person\/9e52e4d22fb53cc9a87adc54825c5e5c"},"headline":"Custom Mobile logging using Infobip API Go SDK and zerolog","datePublished":"2024-01-31T10:00:00+00:00","mainEntityOfPage":{"@id":"https:\/\/www.infobip.com\/developers\/blog\/custom-mobile-logging-using-infobip-api-go-sdk-and-zerolog"},"wordCount":868,"publisher":{"@id":"https:\/\/www.infobip.com\/developers\/#organization"},"image":{"@id":"https:\/\/www.infobip.com\/developers\/blog\/custom-mobile-logging-using-infobip-api-go-sdk-and-zerolog#primaryimage"},"thumbnailUrl":"https:\/\/www.infobip.com\/developers\/wp-content\/uploads\/2024\/01\/joel-jasmin-forestbird-Kfy_FwhfPlc-unsplash-scaled.jpg","keywords":["developer docs"],"articleSection":["Use Case"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.infobip.com\/developers\/blog\/custom-mobile-logging-using-infobip-api-go-sdk-and-zerolog","url":"https:\/\/www.infobip.com\/developers\/blog\/custom-mobile-logging-using-infobip-api-go-sdk-and-zerolog","name":"Custom Mobile logging using Infobip API Go SDK and zerolog - Infobip Developers Hub","isPartOf":{"@id":"https:\/\/www.infobip.com\/developers\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.infobip.com\/developers\/blog\/custom-mobile-logging-using-infobip-api-go-sdk-and-zerolog#primaryimage"},"image":{"@id":"https:\/\/www.infobip.com\/developers\/blog\/custom-mobile-logging-using-infobip-api-go-sdk-and-zerolog#primaryimage"},"thumbnailUrl":"https:\/\/www.infobip.com\/developers\/wp-content\/uploads\/2024\/01\/joel-jasmin-forestbird-Kfy_FwhfPlc-unsplash-scaled.jpg","datePublished":"2024-01-31T10:00:00+00:00","breadcrumb":{"@id":"https:\/\/www.infobip.com\/developers\/blog\/custom-mobile-logging-using-infobip-api-go-sdk-and-zerolog#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.infobip.com\/developers\/blog\/custom-mobile-logging-using-infobip-api-go-sdk-and-zerolog"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.infobip.com\/developers\/blog\/custom-mobile-logging-using-infobip-api-go-sdk-and-zerolog#primaryimage","url":"https:\/\/www.infobip.com\/developers\/wp-content\/uploads\/2024\/01\/joel-jasmin-forestbird-Kfy_FwhfPlc-unsplash-scaled.jpg","contentUrl":"https:\/\/www.infobip.com\/developers\/wp-content\/uploads\/2024\/01\/joel-jasmin-forestbird-Kfy_FwhfPlc-unsplash-scaled.jpg","width":2560,"height":1707},{"@type":"BreadcrumbList","@id":"https:\/\/www.infobip.com\/developers\/blog\/custom-mobile-logging-using-infobip-api-go-sdk-and-zerolog#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.infobip.com\/developers\/"},{"@type":"ListItem","position":2,"name":"Custom Mobile logging using Infobip API Go SDK and zerolog"}]},{"@type":"WebSite","@id":"https:\/\/www.infobip.com\/developers\/#website","url":"https:\/\/www.infobip.com\/developers\/","name":"Infobip Developers Hub","description":"Build meaningful customer relationships across any channel","publisher":{"@id":"https:\/\/www.infobip.com\/developers\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.infobip.com\/developers\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.infobip.com\/developers\/#organization","name":"Infobip Developers Hub","url":"https:\/\/www.infobip.com\/developers\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.infobip.com\/developers\/#\/schema\/logo\/image\/","url":"https:\/\/www.infobip.com\/developers\/wp-content\/uploads\/2023\/03\/Infobip_logo_favicon.png","contentUrl":"https:\/\/www.infobip.com\/developers\/wp-content\/uploads\/2023\/03\/Infobip_logo_favicon.png","width":696,"height":696,"caption":"Infobip Developers Hub"},"image":{"@id":"https:\/\/www.infobip.com\/developers\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/infobip\/","https:\/\/x.com\/InfobipDev","https:\/\/www.youtube.com\/channel\/UCUPSTy53VecI5GIir3J3ZbQ","https:\/\/github.com\/infobip-community"]},{"@type":"Person","@id":"https:\/\/www.infobip.com\/developers\/#\/schema\/person\/9e52e4d22fb53cc9a87adc54825c5e5c","name":"Erick Corona","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.infobip.com\/developers\/#\/schema\/person\/image\/1d096b53aac31da0002a2066ab28c0f1","url":"https:\/\/secure.gravatar.com\/avatar\/c59cdedbf2c066d0ebbb15c5b1da56b1c5b5e7c49e3c4aaf7410dd1462a7b74c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c59cdedbf2c066d0ebbb15c5b1da56b1c5b5e7c49e3c4aaf7410dd1462a7b74c?s=96&d=mm&r=g","caption":"Erick Corona"},"description":"Erick has been in the software industry for more than 10 years. Currently, he works as a Developer Experience Engineer at Infobip. He's interested in software development, writing, and racing car simulators in his free time.","url":"https:\/\/www.infobip.com\/developers\/blog\/author\/erick"}]}},"_links":{"self":[{"href":"https:\/\/www.infobip.com\/developers\/wp-json\/wp\/v2\/posts\/3015","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.infobip.com\/developers\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.infobip.com\/developers\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.infobip.com\/developers\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.infobip.com\/developers\/wp-json\/wp\/v2\/comments?post=3015"}],"version-history":[{"count":4,"href":"https:\/\/www.infobip.com\/developers\/wp-json\/wp\/v2\/posts\/3015\/revisions"}],"predecessor-version":[{"id":3020,"href":"https:\/\/www.infobip.com\/developers\/wp-json\/wp\/v2\/posts\/3015\/revisions\/3020"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.infobip.com\/developers\/wp-json\/wp\/v2\/media\/3017"}],"wp:attachment":[{"href":"https:\/\/www.infobip.com\/developers\/wp-json\/wp\/v2\/media?parent=3015"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.infobip.com\/developers\/wp-json\/wp\/v2\/categories?post=3015"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.infobip.com\/developers\/wp-json\/wp\/v2\/tags?post=3015"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.infobip.com\/developers\/wp-json\/wp\/v2\/coauthors?post=3015"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}