NoRedInk / elm-rollbar / Rollbar

Send reports to Rollbar.

Types


type alias Rollbar =
{ critical : String -> Dict String Json.Encode.Value -> Task Http.Error Uuid
, error : String -> Dict String Json.Encode.Value -> Task Http.Error Uuid
, warning : String -> Dict String Json.Encode.Value -> Task Http.Error Uuid
, info : String -> Dict String Json.Encode.Value -> Task Http.Error Uuid
, debug : String -> Dict String Json.Encode.Value -> Task Http.Error Uuid 
}

Functions preapplied with access tokens, scopes, and environments, separated by Level.

Create one using scoped.


type Level
    = Critical
    | Error
    | Warning
    | Info
    | Debug

Severity levels.


type Token

A Rollbar API access token.

Create one using token.

Rollbar.token "12c99de67a444c229fca100e0967486f"

token : String -> Token

Create a Token

Rollbar.token "12c99de67a444c229fca100e0967486f"


type Environment

For example, "production", "development", or "staging".

Create one using environment.

Rollbar.environment "production"

environment : String -> Environment

Create an Environment

Rollbar.environment "production"


type Scope

A scope, for example "login".

Create one using scope.

Rollbar.scope "login"

scope : String -> Scope

Create a Scope.

Rollbar.scope "login"


type CodeVersion

A code version, for example - a git commit hash.

Create one using codeVersion.

Rollbar.codeVersion "24dcf3a9a9cf1a5e2ea319018644a68f4743a731"

codeVersion : String -> CodeVersion

Create a CodeVersion.

Rollbar.codeVersion "24dcf3a9a9cf1a5e2ea319018644a68f4743a731"

Types

scoped : Token -> CodeVersion -> Environment -> String -> Rollbar

Return a Rollbar record configured with the given Environment and Scope string.

If the HTTP request to Rollbar fails because of an exceeded rate limit (status code 429), this will retry the HTTP request once per second, up to 60 times.

rollbar = Rollbar.scoped "Page/Home.elm"

rollbar.debug "Hitting the hats API." Dict.empty

[ ( "Payload", toString payload ) ]
    |> Dict.fromList
    |> rollbar.error "Unexpected payload from the hats API."

send : Token -> CodeVersion -> Scope -> Environment -> Basics.Int -> Level -> String -> Dict String Json.Encode.Value -> Task Http.Error Uuid

Send a message to Rollbar. scoped provides a nice wrapper around this.

Arguments:

If the message was successfully sent to Rollbar, the Task succeeds with the Uuid it generated and sent to Rollbar to identify the message. Otherwise it fails with the Http.Error responsible.