Module: Snails::Logger::Context
- Defined in:
- runtime/snails/logger/context.rbs,
runtime/snails/logger/context.rb
Class Method Summary collapse
-
.action ⇒ String
the action the router matched, or "".
-
.action=(name) ⇒ String
record the matched action.
-
.add_db_us(microseconds) ⇒ void
add one statement's elapsed time to the current request or job.
-
.begin_job(name, id, attempt) ⇒ void
set the job values a worker loop carries while it runs one job, and reset the DB accumulator.
-
.begin_request ⇒ String
start a new request: mint the id, clear the matched and job fields, and reset the DB accumulator.
-
.controller ⇒ String
the controller class name the router matched, or "" when no controller ran (a 404, a 400, or an app-owned dispatch).
-
.controller=(name) ⇒ String
record the matched controller for the request line.
-
.db_us ⇒ Integer
the DB time accumulated for this request or job, or 0 outside both.
-
.end_job ⇒ void
clear the job values and the DB accumulator after a run.
-
.format ⇒ String
the request format (
jsonby default), or "". -
.format=(name) ⇒ String
record the request format.
-
.job_attempt ⇒ Integer?
the running job's attempt number, or nil.
-
.job_attempt=(attempt) ⇒ Integer?
record the running job's attempt number.
-
.job_events_suppressed? ⇒ Boolean
whether the job running on this thread must not have its
job.started/job.finished/job.failedrecords written. -
.job_id ⇒ Integer?
the running job's id, or nil.
-
.job_id=(id) ⇒ Integer?
record the running job's id.
-
.job_name ⇒ String?
the job running on this thread, or nil.
-
.job_name=(name) ⇒ String?
record the running job's class name.
-
.now_us ⇒ Integer
one reading of the monotonic clock in microseconds.
-
.request_id ⇒ String?
the id of the request this thread is serving, or nil outside a request.
Class Method Details
.action ⇒ String
the action the router matched, or "".
53 |
# File 'runtime/snails/logger/context.rb', line 53
def self.action: () -> String
|
.action=(name) ⇒ String
record the matched action.
61 |
# File 'runtime/snails/logger/context.rb', line 61
def self.action=: (String name) -> String
|
.add_db_us(microseconds) ⇒ void
add one statement's elapsed time to the current request or job. A call outside both is a no-op: boot and non-job DB work has no record to report it on.
105 |
# File 'runtime/snails/logger/context.rb', line 105
def self.add_db_us: (Integer microseconds) -> void
|
.begin_job(name, id, attempt) ⇒ void
set the job values a worker loop carries while it runs one job, and
reset the DB accumulator. The job's ensure calls end_job so a reused
worker thread never leaks the previous job's identity or DB time. A
process-local job has no row id or attempt, so both may be nil; the
logger then omits those fields.
178 |
# File 'runtime/snails/logger/context.rb', line 178
def self.begin_job: (String name, Integer? id, Integer? attempt) -> void
|
.begin_request ⇒ String
start a new request: mint the id, clear the matched and job fields, and reset the DB accumulator. The id is short on purpose: it only has to separate lines within one log stream, and the pid already separates workers.
201 |
# File 'runtime/snails/logger/context.rb', line 201
def self.begin_request: () -> String
|
.controller ⇒ String
the controller class name the router matched, or "" when no controller ran (a 404, a 400, or an app-owned dispatch).
38 |
# File 'runtime/snails/logger/context.rb', line 38
def self.controller: () -> String
|
.controller=(name) ⇒ String
record the matched controller for the request line.
46 |
# File 'runtime/snails/logger/context.rb', line 46
def self.controller=: (String name) -> String
|
.db_us ⇒ Integer
the DB time accumulated for this request or job, or 0 outside both. The value is a subset of the request or job duration, not the remainder: routing, JSON rendering, and the SQLite connection lease sit outside the DB adapter's statement entries.
95 |
# File 'runtime/snails/logger/context.rb', line 95
def self.db_us: () -> Integer
|
.end_job ⇒ void
clear the job values and the DB accumulator after a run.
188 |
# File 'runtime/snails/logger/context.rb', line 188
def self.end_job: () -> void
|
.format ⇒ String
the request format (json by default), or "".
68 |
# File 'runtime/snails/logger/context.rb', line 68
def self.format: () -> String
|
.format=(name) ⇒ String
record the request format.
76 |
# File 'runtime/snails/logger/context.rb', line 76
def self.format=: (String name) -> String
|
.job_attempt ⇒ Integer?
the running job's attempt number, or nil.
145 |
# File 'runtime/snails/logger/context.rb', line 145
def self.job_attempt: () -> Integer?
|
.job_attempt=(attempt) ⇒ Integer?
record the running job's attempt number.
164 |
# File 'runtime/snails/logger/context.rb', line 164
def self.job_attempt=: (Integer? attempt) -> Integer?
|
.job_events_suppressed? ⇒ Boolean
whether the job running on this thread must not have its
job.started/job.finished/job.failed records written. The log
delivery job is the one job that answers yes: those records would be
delivered by the very transport that enqueues it, so each run would feed
the next one. A thread outside a job answers no.
156 |
# File 'runtime/snails/logger/context.rb', line 156
def self.job_events_suppressed?: () -> bool
|
.job_id ⇒ Integer?
the running job's id, or nil.
130 |
# File 'runtime/snails/logger/context.rb', line 130
def self.job_id: () -> Integer?
|
.job_id=(id) ⇒ Integer?
record the running job's id.
138 |
# File 'runtime/snails/logger/context.rb', line 138
def self.job_id=: (Integer? id) -> Integer?
|
.job_name ⇒ String?
the job running on this thread, or nil.
115 |
# File 'runtime/snails/logger/context.rb', line 115
def self.job_name: () -> String?
|
.job_name=(name) ⇒ String?
record the running job's class name.
123 |
# File 'runtime/snails/logger/context.rb', line 123
def self.job_name=: (String? name) -> String?
|
.now_us ⇒ Integer
one reading of the monotonic clock in microseconds. Tep::App measures
the request duration with the same clock, so the summary fields are
comparable.
85 |
# File 'runtime/snails/logger/context.rb', line 85
def self.now_us: () -> Integer
|
.request_id ⇒ String?
the id of the request this thread is serving, or nil outside a request.
30 |
# File 'runtime/snails/logger/context.rb', line 30
def self.request_id: () -> String?
|