Class: Faultline::Configuration
- Inherits:
-
Object
- Object
- Faultline::Configuration
- Defined in:
- lib/faultline/configuration.rb
Instance Attribute Summary collapse
-
#after_create ⇒ Object
Proc called with the LoggedException record after creation.
-
#application_name ⇒ Object
Dashboard title shown in the header.
-
#auth_block ⇒ Object
Proc called with the controller instance before each request.
-
#backtrace_limit ⇒ Object
Maximum number of backtrace frames to show before collapsing (default: 30).
-
#body_class ⇒ Object
CSS class added to the dashboard body element.
-
#date_format ⇒ Object
Date format for display (default: nil = auto relative).
-
#deduplication_enabled ⇒ Object
Enable exception deduplication (default: false).
-
#deduplication_window ⇒ Object
Deduplication time window in seconds (default: 300 = 5 minutes).
-
#enable_navigation ⇒ Object
Enable prev/next navigation in detail view (default: true).
-
#enabled ⇒ Object
Enable/disable the dashboard entirely (default: true).
-
#exception_data ⇒ Object
Proc called with the controller to attach extra data to each exception record.
-
#group_exceptions ⇒ Object
Enable exception grouping in the list (default: false).
-
#keyboard_shortcuts ⇒ Object
Enable keyboard shortcuts in the dashboard (default: true).
-
#log_backtrace ⇒ Object
Include backtrace in logs (default: true).
-
#log_backtrace_limit ⇒ Object
Maximum backtrace lines to include (default: 20).
-
#log_file ⇒ Object
Write logs to a JSON file (path or nil).
-
#log_level ⇒ Object
Log level for faultline logger (default: :info).
-
#log_params ⇒ Object
Include request params in logs (default: true).
-
#log_user_info ⇒ Object
Include user info in logs (default: true).
-
#logging_enabled ⇒ Object
Enable structured logging (default: true).
-
#page_size_options ⇒ Object
Rows per page options for the page size selector (default: [25, 50, 100]).
-
#per_page ⇒ Object
Number of exceptions per page (default: 30).
-
#retention_days ⇒ Object
Automatically delete exceptions older than N days.
-
#show_environment ⇒ Object
Show environment variables in detail view (default: false).
-
#show_metadata ⇒ Object
Show metadata grid in detail view (default: true).
-
#show_request ⇒ Object
Show request params in detail view (default: true).
-
#show_stats ⇒ Object
Show stats overview cards on index page (default: true).
-
#sidebar_links ⇒ Object
Custom links shown in the dashboard sidebar.
-
#table_columns ⇒ Object
Columns to show in the exception table.
-
#theme ⇒ Object
Dashboard theme: "light", "dark", or "auto" (default: "auto").
-
#use_host_layout ⇒ Object
Use the host app's layout instead of faultline's built-in layout.
-
#webhook_headers ⇒ Object
Custom headers sent with webhook requests.
-
#webhook_timeout ⇒ Object
Webhook timeout in seconds (default: 5).
-
#webhooks ⇒ Object
Webhook URLs called on each new exception (POST with JSON body).
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
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_create ⇒ Object
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_name ⇒ Object
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_block ⇒ Object
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_limit ⇒ Object
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_class ⇒ Object
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_format ⇒ Object
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_enabled ⇒ Object
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_window ⇒ Object
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_navigation ⇒ Object
Enable prev/next navigation in detail view (default: true).
140 141 142 |
# File 'lib/faultline/configuration.rb', line 140 def @enable_navigation end |
#enabled ⇒ Object
Enable/disable the dashboard entirely (default: true).
11 12 13 |
# File 'lib/faultline/configuration.rb', line 11 def enabled @enabled end |
#exception_data ⇒ Object
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_exceptions ⇒ Object
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_shortcuts ⇒ Object
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_backtrace ⇒ Object
Include backtrace in logs (default: true).
67 68 69 |
# File 'lib/faultline/configuration.rb', line 67 def log_backtrace @log_backtrace end |
#log_backtrace_limit ⇒ Object
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_file ⇒ Object
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_level ⇒ Object
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_params ⇒ Object
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_info ⇒ Object
Include user info in logs (default: true).
73 74 75 |
# File 'lib/faultline/configuration.rb', line 73 def log_user_info @log_user_info end |
#logging_enabled ⇒ Object
Enable structured logging (default: true).
55 56 57 |
# File 'lib/faultline/configuration.rb', line 55 def logging_enabled @logging_enabled end |
#page_size_options ⇒ Object
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 end |
#per_page ⇒ Object
Number of exceptions per page (default: 30).
14 15 16 |
# File 'lib/faultline/configuration.rb', line 14 def per_page @per_page end |
#retention_days ⇒ Object
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_environment ⇒ Object
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_metadata ⇒ Object
Show metadata grid in detail view (default: true).
128 129 130 |
# File 'lib/faultline/configuration.rb', line 128 def @show_metadata end |
#show_request ⇒ Object
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_stats ⇒ Object
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 |
#sidebar_links ⇒ Object
Custom links shown in the dashboard sidebar. Example:
config. = [
{ 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 end |
#table_columns ⇒ Object
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 |
#theme ⇒ Object
Dashboard theme: "light", "dark", or "auto" (default: "auto").
95 96 97 |
# File 'lib/faultline/configuration.rb', line 95 def theme @theme end |
#use_host_layout ⇒ Object
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_headers ⇒ Object
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_timeout ⇒ Object
Webhook timeout in seconds (default: 5).
45 46 47 |
# File 'lib/faultline/configuration.rb', line 45 def webhook_timeout @webhook_timeout end |
#webhooks ⇒ Object
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 |