Class: Faultline::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/faultline/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
# File 'lib/faultline/configuration.rb', line 152

def initialize
  @application_name = nil
  @auth_block = nil
  @exception_data = nil
  @after_create = nil
  @per_page = 30
  @enabled = true

  # Notifications
  @webhooks = []
  @webhook_timeout = 5
  @webhook_headers = {}

  # Logging
  @logging_enabled = true
  @log_level = :info
  @log_file = nil
  @log_backtrace = true
  @log_params = true
  @log_user_info = true
  @log_backtrace_limit = 20
  @deduplication_enabled = false
  @deduplication_window = 300

  # Cleanup
  @retention_days = nil

  # Appearance
  @theme = "auto"
  @use_host_layout = false
  @body_class = ""

  # Sidebar
  @sidebar_links = []

  # Advanced UI
  @show_stats = true
  @keyboard_shortcuts = true
  @group_exceptions = false
  @show_metadata = true
  @show_environment = false
  @show_request = true
  @backtrace_limit = 30
  @enable_navigation = true
  @table_columns = %i[class controller action message time].freeze
  @date_format = nil
  @page_size_options = [25, 50, 100].freeze
end

Instance Attribute Details

#after_createObject

Proc called with the LoggedException record after creation. Use for Telegram, Slack, email, or custom notifications. Example:

config.after_create = ->(exception) { MyNotifier.alert(exception) }


37
38
39
# File 'lib/faultline/configuration.rb', line 37

def after_create
  @after_create
end

#application_nameObject

Dashboard title shown in the header. Set to nil to use "Faultline".



8
9
10
# File 'lib/faultline/configuration.rb', line 8

def application_name
  @application_name
end

#auth_blockObject

Proc called with the controller instance before each request. Return false/nil to deny access; return true to allow. Example:

config.auth_block = ->(controller) { controller.current_user&.admin? }


22
23
24
# File 'lib/faultline/configuration.rb', line 22

def auth_block
  @auth_block
end

#backtrace_limitObject

Maximum number of backtrace frames to show before collapsing (default: 30).



137
138
139
# File 'lib/faultline/configuration.rb', line 137

def backtrace_limit
  @backtrace_limit
end

#body_classObject

CSS class added to the dashboard body element.



103
104
105
# File 'lib/faultline/configuration.rb', line 103

def body_class
  @body_class
end

#date_formatObject

Date format for display (default: nil = auto relative).



147
148
149
# File 'lib/faultline/configuration.rb', line 147

def date_format
  @date_format
end

#deduplication_enabledObject

Enable exception deduplication (default: false). When enabled, only logs unique exception class + controller combinations within a time window.



81
82
83
# File 'lib/faultline/configuration.rb', line 81

def deduplication_enabled
  @deduplication_enabled
end

#deduplication_windowObject

Deduplication time window in seconds (default: 300 = 5 minutes).



84
85
86
# File 'lib/faultline/configuration.rb', line 84

def deduplication_window
  @deduplication_window
end

#enable_navigationObject

Enable prev/next navigation in detail view (default: true).



140
141
142
# File 'lib/faultline/configuration.rb', line 140

def enable_navigation
  @enable_navigation
end

#enabledObject

Enable/disable the dashboard entirely (default: true).



11
12
13
# File 'lib/faultline/configuration.rb', line 11

def enabled
  @enabled
end

#exception_dataObject

Proc called with the controller to attach extra data to each exception record. Example:

config.exception_data = ->(controller) { { user_id: controller.current_user&.id } }


29
30
31
# File 'lib/faultline/configuration.rb', line 29

def exception_data
  @exception_data
end

#group_exceptionsObject

Enable exception grouping in the list (default: false). Groups exceptions by class + controller.



125
126
127
# File 'lib/faultline/configuration.rb', line 125

def group_exceptions
  @group_exceptions
end

#keyboard_shortcutsObject

Enable keyboard shortcuts in the dashboard (default: true).



121
122
123
# File 'lib/faultline/configuration.rb', line 121

def keyboard_shortcuts
  @keyboard_shortcuts
end

#log_backtraceObject

Include backtrace in logs (default: true).



67
68
69
# File 'lib/faultline/configuration.rb', line 67

def log_backtrace
  @log_backtrace
end

#log_backtrace_limitObject

Maximum backtrace lines to include (default: 20).



76
77
78
# File 'lib/faultline/configuration.rb', line 76

def log_backtrace_limit
  @log_backtrace_limit
end

#log_fileObject

Write logs to a JSON file (path or nil). Example:

config.log_file = "log/faultline.log"


64
65
66
# File 'lib/faultline/configuration.rb', line 64

def log_file
  @log_file
end

#log_levelObject

Log level for faultline logger (default: :info). Options: :debug, :info, :warn, :error, :fatal



59
60
61
# File 'lib/faultline/configuration.rb', line 59

def log_level
  @log_level
end

#log_paramsObject

Include request params in logs (default: true).



70
71
72
# File 'lib/faultline/configuration.rb', line 70

def log_params
  @log_params
end

#log_user_infoObject

Include user info in logs (default: true).



73
74
75
# File 'lib/faultline/configuration.rb', line 73

def 
  @log_user_info
end

#logging_enabledObject

Enable structured logging (default: true).



55
56
57
# File 'lib/faultline/configuration.rb', line 55

def logging_enabled
  @logging_enabled
end

#page_size_optionsObject

Rows per page options for the page size selector (default: [25, 50, 100]).



150
151
152
# File 'lib/faultline/configuration.rb', line 150

def page_size_options
  @page_size_options
end

#per_pageObject

Number of exceptions per page (default: 30).



14
15
16
# File 'lib/faultline/configuration.rb', line 14

def per_page
  @per_page
end

#retention_daysObject

Automatically delete exceptions older than N days. Set to nil to disable (default: nil).



90
91
92
# File 'lib/faultline/configuration.rb', line 90

def retention_days
  @retention_days
end

#show_environmentObject

Show environment variables in detail view (default: false).



131
132
133
# File 'lib/faultline/configuration.rb', line 131

def show_environment
  @show_environment
end

#show_metadataObject

Show metadata grid in detail view (default: true).



128
129
130
# File 'lib/faultline/configuration.rb', line 128

def 
  @show_metadata
end

#show_requestObject

Show request params in detail view (default: true).



134
135
136
# File 'lib/faultline/configuration.rb', line 134

def show_request
  @show_request
end

#show_statsObject

Show stats overview cards on index page (default: true).



118
119
120
# File 'lib/faultline/configuration.rb', line 118

def show_stats
  @show_stats
end

Custom links shown in the dashboard sidebar. Example:

config.sidebar_links = [
{ label: "GitHub", url: "https://github.com/myorg/myapp", icon: "code" },
{ label: "Docs", url: "/docs", icon: "book" }
]


113
114
115
# File 'lib/faultline/configuration.rb', line 113

def sidebar_links
  @sidebar_links
end

#table_columnsObject

Columns to show in the exception table. Default: [:class, :controller, :action, :message, :time]



144
145
146
# File 'lib/faultline/configuration.rb', line 144

def table_columns
  @table_columns
end

#themeObject

Dashboard theme: "light", "dark", or "auto" (default: "auto").



95
96
97
# File 'lib/faultline/configuration.rb', line 95

def theme
  @theme
end

#use_host_layoutObject

Use the host app's layout instead of faultline's built-in layout. Set to true to render inside the host app's sidebar/nav. Set to false (default) for a standalone dashboard.



100
101
102
# File 'lib/faultline/configuration.rb', line 100

def use_host_layout
  @use_host_layout
end

#webhook_headersObject

Custom headers sent with webhook requests. Example:

config.webhook_headers = { "Authorization" => "Bearer token123" }


50
51
52
# File 'lib/faultline/configuration.rb', line 50

def webhook_headers
  @webhook_headers
end

#webhook_timeoutObject

Webhook timeout in seconds (default: 5).



45
46
47
# File 'lib/faultline/configuration.rb', line 45

def webhook_timeout
  @webhook_timeout
end

#webhooksObject

Webhook URLs called on each new exception (POST with JSON body). Example:

config.webhooks = ["https://hooks.slack.com/services/xxx"]


42
43
44
# File 'lib/faultline/configuration.rb', line 42

def webhooks
  @webhooks
end