@@ -42,7 +42,29 @@ Layout <- R6::R6Class(
4242 toString(event )
4343 },
4444
45- toString = function () fmt_class(class(self )[[1 ]])
45+ toString = function () fmt_class(class(self )[[1 ]]),
46+
47+ # . . setters -----------------------------------------------------------------
48+ set_excluded_fields = function (x ){
49+ assert(is.null(x ) || is.character(x ))
50+ private $ .excluded_fields <- x
51+ invisible (self )
52+ }
53+ ),
54+
55+
56+ # . . active --------------------------------------------------------------
57+ active = list (
58+ # ' @field excluded_fields fields to exclude from the final log
59+ excluded_fields = function () {
60+ get(" .excluded_fields" , private )
61+ }
62+ ),
63+
64+
65+ # . . private -------------------------------------------------------------
66+ private = list (
67+ .excluded_fields = NULL
4668 )
4769)
4870
@@ -86,12 +108,14 @@ LayoutFormat <- R6::R6Class(
86108 fmt = " %L [%t] %m %j" ,
87109 timestamp_fmt = " %Y-%m-%d %H:%M:%OS3" ,
88110 colors = NULL ,
89- pad_levels = " right"
111+ pad_levels = " right" ,
112+ excluded_fields = NULL
90113 ){
91114 self $ set_fmt(fmt )
92115 self $ set_timestamp_fmt(timestamp_fmt )
93116 self $ set_colors(colors )
94117 self $ set_pad_levels(pad_levels )
118+ self $ set_excluded_fields(excluded_fields )
95119 },
96120
97121 # ' @description Format a LogEvent
@@ -104,7 +128,8 @@ LayoutFormat <- R6::R6Class(
104128 fmt = private $ .fmt ,
105129 timestamp_fmt = private $ .timestamp_fmt ,
106130 colors = private $ .colors ,
107- pad_levels = private $ .pad_levels
131+ pad_levels = private $ .pad_levels ,
132+ excluded_fields = private $ .excluded_fields
108133 )
109134 },
110135
@@ -335,16 +360,16 @@ LayoutJson <- R6::R6Class(
335360 initialize = function (
336361 toJSON_args = list (auto_unbox = TRUE ),
337362 timestamp_fmt = NULL ,
338- excluded_properties = " rawMsg"
363+ excluded_fields = " rawMsg"
339364 ){
340365 self $ set_toJSON_args(toJSON_args )
341366 self $ set_timestamp_fmt(timestamp_fmt )
342- self $ set_excluded_properties( excluded_properties )
367+ self $ set_excluded_fields( excluded_fields )
343368 },
344369
345370 format_event = function (event ) {
346371 vals <- get(" values" , event )
347- vals <- vals [! names(vals ) %in% self $ excluded_properties ]
372+ vals <- vals [! names(vals ) %in% self $ excluded_fields ]
348373 fmt <- get(" timestamp_fmt" , self )
349374
350375 if (! is.null(fmt )){
@@ -384,12 +409,6 @@ LayoutJson <- R6::R6Class(
384409 invisible (self )
385410 },
386411
387- set_excluded_properties = function (x ){
388- assert(is.null(x ) || is.character(x ))
389- private $ .excluded_properties <- x
390- invisible (self )
391- },
392-
393412 # . . methods ----------------------------------------------------------------
394413
395414 toString = function () {
@@ -435,20 +454,13 @@ LayoutJson <- R6::R6Class(
435454 # ' @field timestamp_fmt Used by `$format_event()` to format timestamps.
436455 timestamp_fmt = function () {
437456 get(" .timestamp_fmt" , private )
438- },
439-
440- # ' @field excluded_properties Used by `$format_event()` to exclude selected
441- # ' properties before serialization
442- excluded_properties = function () {
443- get(" .excluded_properties" , private )
444457 }
445458 ),
446459
447460 # . . private --------------------------------------------------------------
448461 private = list (
449462 .toJSON_args = NULL ,
450- .timestamp_fmt = NULL ,
451- .excluded_properties = NULL
463+ .timestamp_fmt = NULL
452464 )
453465)
454466
0 commit comments