Liking cljdoc? Tell your friends :D

sentry-clj.logging

Structured logging integration with Sentry.

Provides logging functions at all standard levels:

  • trace, debug, info, warn, error, fatal - Level-specific logging functions
  • log - Generic logging function accepting level as parameter, supports structured logging with maps

Basic Usage

(info "User logged in: %s" username)
(error "Database error: %s" (.getMessage ex))

Generic Logging

(log :warn "Service unavailable")
(log :error "Failed operation: %s" operation-name)

Structured Logging

(log :fatal 
     {:user-id "123" :operation "payment" :critical true}
     "Critical system failure")
Structured logging integration with Sentry.

Provides logging functions at all standard levels:
- `trace`, `debug`, `info`, `warn`, `error`, `fatal` - Level-specific logging functions
- `log` - Generic logging function accepting level as parameter, supports structured logging with maps

## Basic Usage
```clojure
(info "User logged in: %s" username)
(error "Database error: %s" (.getMessage ex))
```

## Generic Logging
```clojure
(log :warn "Service unavailable")
(log :error "Failed operation: %s" operation-name)
```

## Structured Logging
```clojure
(log :fatal 
     {:user-id "123" :operation "payment" :critical true}
     "Critical system failure")
```
raw docstring

debugclj

(debug message & args)
source

errorclj

(error message & args)
source

fatalclj

(fatal message & args)
source

infoclj

(info message & args)
source

logclj

(log level & args)

Generic logging function that accepts log level and optional parameters.

Usage Examples

Basic logging with level keyword:

(log :error "Something went wrong")
(log :info "User %s logged in from %s" username ip-address)

Structured logging with attributes:

(log :fatal
     {:user-id "123"
      :operation "checkout"
      :critical true
      :amount 99.99}
     "Payment processing failed for user %s"
     user-id)

Logging with custom timestamp:

(log :warn
     (SentryInstantDate.)
     "Delayed processing detected at %s"
     (System/currentTimeMillis))

Parameters

  • level - Log level keyword (:trace, :debug, :info, :warn, :error, :fatal) or SentryLogLevel enum
  • args - Message and optional parameters: either [message & format-args] or [date-or-params message & format-args]
Generic logging function that accepts log level and optional parameters.

## Usage Examples

### Basic logging with level keyword:
```clojure
(log :error "Something went wrong")
(log :info "User %s logged in from %s" username ip-address)
```

### Structured logging with attributes:
```clojure
(log :fatal
     {:user-id "123"
      :operation "checkout"
      :critical true
      :amount 99.99}
     "Payment processing failed for user %s"
     user-id)
```

### Logging with custom timestamp:
```clojure
(log :warn
     (SentryInstantDate.)
     "Delayed processing detected at %s"
     (System/currentTimeMillis))
```

## Parameters
- `level` - Log level keyword (`:trace`, `:debug`, `:info`, `:warn`, `:error`, `:fatal`) or SentryLogLevel enum
- `args` - Message and optional parameters: either `[message & format-args]` or `[date-or-params message & format-args]`
sourceraw docstring

traceclj

(trace message & args)
source

warnclj

(warn message & args)
source

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close