logging: delay documentation polishing

Based on PR feedback.
This commit is contained in:
Arne Welzel 2023-11-28 11:39:14 +01:00
parent e2ce929fa4
commit fd096b1ce6
6 changed files with 31 additions and 23 deletions

View file

@ -407,12 +407,20 @@ export {
## Maximum delay interval for this stream. ## Maximum delay interval for this stream.
## ##
## This value can be increased using :zeek:see:`Log::set_max_delay_interval`
## after the stream has been created.
##
## .. :zeek:see:`Log::default_max_delay_interval` ## .. :zeek:see:`Log::default_max_delay_interval`
## .. :zeek:see:`Log::set_max_delay_interval`
max_delay_interval: interval &default=default_max_delay_interval; max_delay_interval: interval &default=default_max_delay_interval;
## Maximum delay queue size of this stream. ## Maximum delay queue size of this stream.
## ##
## This value can be changed using :zeek:see:`Log::set_max_delay_queue_size`
## after the stream has been created.
##
## .. :zeek:see:`Log::default_max_delay_queue_size` ## .. :zeek:see:`Log::default_max_delay_queue_size`
## .. :zeek:see:`Log::set_max_delay_queue_size`
max_delay_queue_size: count &default=default_max_delay_queue_size; max_delay_queue_size: count &default=default_max_delay_queue_size;
}; };
@ -626,11 +634,11 @@ export {
## Type of function to invoke when delaying a log write has completed. ## Type of function to invoke when delaying a log write has completed.
## ##
## This is similar to a :zeek:see:`Log::StreamPolicyHook`, but a callback ## Functions of this type take the same arguments as :zeek:see:`Log::StreamPolicyHook`
## of this type is passed to zeek:see:`Log::delay` and executes just before ## and act as a callback passed to zeek:see:`Log::delay`. They execute
## the record is forwarded to the individual log filters. ## just before the record is forwarded to the individual log filters.
## ##
## Returning false from a post delay callback discards the log write. ## Returning ``F`` from a post delay callback discards the log write.
type PostDelayCallback: function(rec: any, id: ID): bool; type PostDelayCallback: function(rec: any, id: ID): bool;
## Type of the opaque value returned by :zeek:see:`Log::delay`. These ## Type of the opaque value returned by :zeek:see:`Log::delay`. These
@ -652,21 +660,21 @@ export {
## Conceptually, the delay is inserted between the execution of the ## Conceptually, the delay is inserted between the execution of the
## zeek:see:`Log::log_stream_policy` hook and the policy hooks of filters. ## zeek:see:`Log::log_stream_policy` hook and the policy hooks of filters.
## ##
## Calling this function increases a reference count that can subsequently ## Calling this function increments a reference count that can subsequently
## be released using :zeek:see:`Log::delay_finish`. ## be decremented using :zeek:see:`Log::delay_finish`.
## The delay completes when either the reference count reaches zero, or ## The delay completes when either the reference count reaches zero, or
## the configured maximum delay interval for the stream expires. The ## the configured maximum delay interval for the stream expires. The
## optional *post_delay_callback* is invoked when the delay completed. ## optional *post_delay_cb* is invoked when the delay completed.
## ##
## The *post_delay_callback* function can extend the delay by invoking ## The *post_delay_cb* function can extend the delay by invoking
## :zeek:see:`Log::delay`. There's no limit to how often a write can be ## :zeek:see:`Log::delay` again. There's no limit to how often a write
## re-delayed. Further, it can veto the forwarding of the log record ## can be re-delayed. Further, it can discard the log record altogether
## to the stream's filters by returning ``F``. If *post_delay_cb* is not ## by returning ``F``. If *post_delay_cb* is not provided, the behavior
## provided, it's equivalent to a function solely returning ``T``. ## is equivalent to a no-op callback solely returning ``T``.
## ##
## id: The ID associated with a logging stream. ## id: The ID associated with a logging stream.
## ##
## rec: Log record ## rec: The log record.
## ##
## post_delay_cb: A callback to invoke when the delay completed. ## post_delay_cb: A callback to invoke when the delay completed.
## ##
@ -681,7 +689,7 @@ export {
## ##
## id: The ID associated with a logging stream. ## id: The ID associated with a logging stream.
## ##
## rec: Log record ## rec: The log record.
## ##
## token: The opaque token as returned by :zeek:see:`Log::delay`. ## token: The opaque token as returned by :zeek:see:`Log::delay`.
## ##

View file

@ -147,7 +147,7 @@ private:
// Has this DelayInfo object been enqueued? // Has this DelayInfo object been enqueued?
bool enqueued = false; bool enqueued = false;
// Iterator pointing this instance in the delay_queue. // Iterator pointing at this instance in the delay_queue.
DelayQueue::const_iterator queue_position; DelayQueue::const_iterator queue_position;
}; };

View file

@ -1,4 +1,4 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
error in <...>/main.zeek, line 634 and <...>/static-errors.zeek, line 12: type clash (Log::PostDelayCallback and post_delay_cb) error in <...>/main.zeek, line 642 and <...>/static-errors.zeek, line 12: type clash (Log::PostDelayCallback and post_delay_cb)
error in <...>/static-errors.zeek, line 12 and <...>/main.zeek, line 634: type mismatch (post_delay_cb and Log::PostDelayCallback) error in <...>/static-errors.zeek, line 12 and <...>/main.zeek, line 642: type mismatch (post_delay_cb and Log::PostDelayCallback)
error in <...>/static-errors.zeek, line 12: argument type mismatch in function call (Log::delay(id, to_any_coercerec, post_delay_cb)) error in <...>/static-errors.zeek, line 12: argument type mismatch in function call (Log::delay(id, to_any_coercerec, post_delay_cb))

View file

@ -1,4 +1,4 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
error in <...>/main.zeek, line 639 and <...>/static-errors.zeek, line 8: type clash (Log::DelayToken and 42) error in <...>/main.zeek, line 647 and <...>/static-errors.zeek, line 8: type clash (Log::DelayToken and 42)
error in <...>/static-errors.zeek, line 8 and <...>/main.zeek, line 639: type mismatch (42 and Log::DelayToken) error in <...>/static-errors.zeek, line 8 and <...>/main.zeek, line 647: type mismatch (42 and Log::DelayToken)
error in <...>/static-errors.zeek, line 8: argument type mismatch in function call (Log::delay_finish(id, to_any_coercerec, 42)) error in <...>/static-errors.zeek, line 8: argument type mismatch in function call (Log::delay_finish(id, to_any_coercerec, 42))

View file

@ -1,4 +1,4 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
error in <...>/main.zeek, line 639 and <...>/static-errors.zeek, line 8: arithmetic mixed with non-arithmetic (Log::DelayToken and 42) error in <...>/main.zeek, line 647 and <...>/static-errors.zeek, line 8: arithmetic mixed with non-arithmetic (Log::DelayToken and 42)
error in <...>/static-errors.zeek, line 8 and <...>/main.zeek, line 639: type mismatch (42 and Log::DelayToken) error in <...>/static-errors.zeek, line 8 and <...>/main.zeek, line 647: type mismatch (42 and Log::DelayToken)
error in <...>/static-errors.zeek, line 8: argument type mismatch in function call (Log::delay_finish(id, to_any_coercerec, 42)) error in <...>/static-errors.zeek, line 8: argument type mismatch in function call (Log::delay_finish(id, to_any_coercerec, 42))

View file

@ -1,4 +1,4 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
error in <...>/main.zeek, line 634 and <...>/static-errors.zeek, line 16: type clash (Log::PostDelayCallback and post_delay_cb) error in <...>/main.zeek, line 642 and <...>/static-errors.zeek, line 16: type clash (Log::PostDelayCallback and post_delay_cb)
error in <...>/static-errors.zeek, line 16 and <...>/main.zeek, line 634: type mismatch (post_delay_cb and Log::PostDelayCallback) error in <...>/static-errors.zeek, line 16 and <...>/main.zeek, line 642: type mismatch (post_delay_cb and Log::PostDelayCallback)
error in <...>/static-errors.zeek, line 16: argument type mismatch in function call (Log::delay(id, to_any_coercerec, post_delay_cb)) error in <...>/static-errors.zeek, line 16: argument type mismatch in function call (Log::delay(id, to_any_coercerec, post_delay_cb))