Liking cljdoc? Tell your friends :D

wagoe.observability.logging.ports

Port definitions for logging infrastructure.

This namespace defines the protocols that logging adapters must implement, providing a clean abstraction over different logging backends (stdout, JSON, structured logging systems, etc.).

Core protocols:

  • ILogger: Basic application logging with levels and context
  • IAuditLogger: Structured audit logging for compliance and monitoring

Context Map Structure: {:correlation-id string - Request correlation ID :request-id string - HTTP request ID
:tenant-id string - Multi-tenant context :user-id string - User context (if authenticated) :span-id string - Distributed tracing span ID :trace-id string - Distributed tracing trace ID :tags map - Additional structured tags}

Port definitions for logging infrastructure.

This namespace defines the protocols that logging adapters must implement,
providing a clean abstraction over different logging backends (stdout, JSON,
structured logging systems, etc.).

Core protocols:
- ILogger: Basic application logging with levels and context
- IAuditLogger: Structured audit logging for compliance and monitoring

Context Map Structure:
{:correlation-id string - Request correlation ID
 :request-id    string - HTTP request ID  
 :tenant-id     string - Multi-tenant context
 :user-id       string - User context (if authenticated)
 :span-id       string - Distributed tracing span ID
 :trace-id      string - Distributed tracing trace ID
 :tags          map    - Additional structured tags}
raw docstring

IAuditLoggercljprotocol

Specialized logging for audit events and compliance.

Audit logs are structured events that track:

  • User actions (create, update, delete)
  • System state changes
  • Security events
  • Compliance-relevant activities
Specialized logging for audit events and compliance.

Audit logs are structured events that track:
- User actions (create, update, delete)
- System state changes
- Security events
- Compliance-relevant activities

audit-eventclj

(audit-event this event-type actor resource action result context)

Log a structured audit event.

Parameters: event-type - Keyword event type (:user-action :system-event :security-event) actor - Who performed the action (user-id, system, api-key, etc.) resource - What was acted upon (user, invoice, etc.) action - What action was taken (create, update, delete, view) result - Outcome (success, failure, partial) context - Additional structured context

Returns: nil (side effect only)

Log a structured audit event.

Parameters:
  event-type - Keyword event type (:user-action :system-event :security-event)
  actor      - Who performed the action (user-id, system, api-key, etc.)
  resource   - What was acted upon (user, invoice, etc.)
  action     - What action was taken (create, update, delete, view)
  result     - Outcome (success, failure, partial)
  context    - Additional structured context

Returns:
  nil (side effect only)

security-eventclj

(security-event this event-type severity details context)

Log security-related events.

Parameters: event-type - Keyword (:login-attempt :permission-denied :suspicious-activity) severity - Keyword (:low :medium :high :critical) details - Map with event-specific details context - Standard context map

Returns: nil (side effect only)

Log security-related events.

Parameters:
  event-type - Keyword (:login-attempt :permission-denied :suspicious-activity)
  severity   - Keyword (:low :medium :high :critical)
  details    - Map with event-specific details
  context    - Standard context map

Returns:
  nil (side effect only)
sourceraw docstring

ILoggercljprotocol

Core logging interface for application events.

All log methods accept:

  • message: String message or format string
  • context: Optional map with correlation-id, request-id, tenant-id, etc.
  • exception: Optional exception/throwable for error logs
Core logging interface for application events.

All log methods accept:
- message: String message or format string
- context: Optional map with correlation-id, request-id, tenant-id, etc.
- exception: Optional exception/throwable for error logs

debugclj

(debug this message)
(debug this message context)

Log at DEBUG level for development debugging

Log at DEBUG level for development debugging

errorclj

(error this message)
(error this message context)
(error this message context exception)

Log at ERROR level for application errors

Log at ERROR level for application errors

fatalclj

(fatal this message)
(fatal this message context)
(fatal this message context exception)

Log at FATAL level for critical system failures

Log at FATAL level for critical system failures

infoclj

(info this message)
(info this message context)

Log at INFO level for normal application flow

Log at INFO level for normal application flow

log*clj

(log* this level message context exception)

Low-level logging method. All other methods delegate to this.

Parameters: level - Keyword log level (:trace :debug :info :warn :error :fatal) message - String message or format string context - Map with structured context (correlation-id, tags, etc.) exception - Optional throwable/exception

Returns: nil (side effect only)

Low-level logging method. All other methods delegate to this.

Parameters:
  level     - Keyword log level (:trace :debug :info :warn :error :fatal)
  message   - String message or format string
  context   - Map with structured context (correlation-id, tags, etc.)
  exception - Optional throwable/exception

Returns:
  nil (side effect only)

traceclj

(trace this message)
(trace this message context)

Log at TRACE level for very detailed debugging

Log at TRACE level for very detailed debugging

warnclj

(warn this message)
(warn this message context)
(warn this message context exception)

Log at WARN level for recoverable issues

Log at WARN level for recoverable issues
sourceraw docstring

ILoggingConfigcljprotocol

Protocol for runtime logging configuration changes.

This allows for dynamic adjustment of logging behavior without requiring application restart.

Protocol for runtime logging configuration changes.

This allows for dynamic adjustment of logging behavior without
requiring application restart.

get-configclj

(get-config this)

Get the current logging configuration.

Returns: Map of current configuration options

Get the current logging configuration.

Returns:
  Map of current configuration options

get-levelclj

(get-level this)

Get the current minimum logging level.

Returns: Keyword log level

Get the current minimum logging level.

Returns:
  Keyword log level

set-config!clj

(set-config! this config-map)

Update logging configuration.

Parameters: config-map - Map of configuration options (adapter-specific)

Returns: Previous configuration map

Update logging configuration.

Parameters:
  config-map - Map of configuration options (adapter-specific)

Returns:
  Previous configuration map

set-level!clj

(set-level! this level)

Change the minimum logging level.

Parameters: level - Keyword log level (:trace :debug :info :warn :error :fatal)

Returns: Previous level

Change the minimum logging level.

Parameters:
  level - Keyword log level (:trace :debug :info :warn :error :fatal)

Returns:
  Previous level
sourceraw docstring

ILoggingContextcljprotocol

Protocol for managing logging context across request lifecycle.

This allows for correlation IDs, request context, and other metadata to be automatically included in all log messages within a request scope.

Protocol for managing logging context across request lifecycle.

This allows for correlation IDs, request context, and other metadata
to be automatically included in all log messages within a request scope.

current-contextclj

(current-context this)

Get the current logging context map.

Returns: Map of current context keys/values

Get the current logging context map.

Returns:
  Map of current context keys/values

with-contextclj

(with-context this context-map f)

Execute function f with additional logging context.

The context-map will be merged with any existing context and made available to all logging calls within the execution of f.

Parameters: context-map - Map of context keys/values to add f - Zero-argument function to execute

Returns: Result of calling (f)

Execute function f with additional logging context.

The context-map will be merged with any existing context and made
available to all logging calls within the execution of f.

Parameters:
  context-map - Map of context keys/values to add
  f          - Zero-argument function to execute

Returns:
  Result of calling (f)
sourceraw docstring

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