1717
1818static void assign_log_level_console (ConfigOption * opt , const char * arg );
1919static void assign_log_level_file (ConfigOption * opt , const char * arg );
20+ static void assign_log_format_console (ConfigOption * opt , const char * arg );
21+ static void assign_log_format_file (ConfigOption * opt , const char * arg );
2022static void assign_compress_alg (ConfigOption * opt , const char * arg );
2123
2224static char * get_log_level_console (ConfigOption * opt );
2325static char * get_log_level_file (ConfigOption * opt );
26+ static char * get_log_format_console (ConfigOption * opt );
27+ static char * get_log_format_file (ConfigOption * opt );
2428static char * get_compress_alg (ConfigOption * opt );
2529
2630static void show_configure_start (void );
@@ -154,90 +158,100 @@ ConfigOption instance_options[] =
154158 OPTION_LOG_GROUP , 0 , get_log_level_file
155159 },
156160 {
157- 's' , 214 , "log-filename" ,
161+ 'f' , 214 , "log-format-console" ,
162+ assign_log_format_console , SOURCE_CMD_STRICT , 0 ,
163+ OPTION_LOG_GROUP , 0 , get_log_format_console
164+ },
165+ {
166+ 'f' , 215 , "log-format-file" ,
167+ assign_log_format_file , SOURCE_CMD , 0 ,
168+ OPTION_LOG_GROUP , 0 , get_log_format_file
169+ },
170+ {
171+ 's' , 216 , "log-filename" ,
158172 & instance_config .logger .log_filename , SOURCE_CMD , 0 ,
159173 OPTION_LOG_GROUP , 0 , option_get_value
160174 },
161175 {
162- 's' , 215 , "error-log-filename" ,
176+ 's' , 217 , "error-log-filename" ,
163177 & instance_config .logger .error_log_filename , SOURCE_CMD , 0 ,
164178 OPTION_LOG_GROUP , 0 , option_get_value
165179 },
166180 {
167- 's' , 216 , "log-directory" ,
181+ 's' , 218 , "log-directory" ,
168182 & instance_config .logger .log_directory , SOURCE_CMD , 0 ,
169183 OPTION_LOG_GROUP , 0 , option_get_value
170184 },
171185 {
172- 'U' , 217 , "log-rotation-size" ,
186+ 'U' , 219 , "log-rotation-size" ,
173187 & instance_config .logger .log_rotation_size , SOURCE_CMD , SOURCE_DEFAULT ,
174188 OPTION_LOG_GROUP , OPTION_UNIT_KB , option_get_value
175189 },
176190 {
177- 'U' , 218 , "log-rotation-age" ,
191+ 'U' , 220 , "log-rotation-age" ,
178192 & instance_config .logger .log_rotation_age , SOURCE_CMD , SOURCE_DEFAULT ,
179193 OPTION_LOG_GROUP , OPTION_UNIT_MS , option_get_value
180194 },
181195 /* Retention options */
182196 {
183- 'u' , 219 , "retention-redundancy" ,
197+ 'u' , 221 , "retention-redundancy" ,
184198 & instance_config .retention_redundancy , SOURCE_CMD , 0 ,
185199 OPTION_RETENTION_GROUP , 0 , option_get_value
186200 },
187201 {
188- 'u' , 220 , "retention-window" ,
202+ 'u' , 222 , "retention-window" ,
189203 & instance_config .retention_window , SOURCE_CMD , 0 ,
190204 OPTION_RETENTION_GROUP , 0 , option_get_value
191205 },
192206 {
193- 'u' , 221 , "wal-depth" ,
207+ 'u' , 223 , "wal-depth" ,
194208 & instance_config .wal_depth , SOURCE_CMD , 0 ,
195209 OPTION_RETENTION_GROUP , 0 , option_get_value
196210 },
197211 /* Compression options */
198212 {
199- 'f' , 222 , "compress-algorithm" ,
213+ 'f' , 224 , "compress-algorithm" ,
200214 assign_compress_alg , SOURCE_CMD , 0 ,
201215 OPTION_COMPRESS_GROUP , 0 , get_compress_alg
202216 },
203217 {
204- 'u' , 223 , "compress-level" ,
218+ 'u' , 225 , "compress-level" ,
205219 & instance_config .compress_level , SOURCE_CMD , 0 ,
206220 OPTION_COMPRESS_GROUP , 0 , option_get_value
207221 },
208222 /* Remote backup options */
209223 {
210- 's' , 224 , "remote-proto" ,
224+ 's' , 226 , "remote-proto" ,
211225 & instance_config .remote .proto , SOURCE_CMD , 0 ,
212226 OPTION_REMOTE_GROUP , 0 , option_get_value
213227 },
214228 {
215- 's' , 225 , "remote-host" ,
229+ 's' , 227 , "remote-host" ,
216230 & instance_config .remote .host , SOURCE_CMD , 0 ,
217231 OPTION_REMOTE_GROUP , 0 , option_get_value
218232 },
219233 {
220- 's' , 226 , "remote-port" ,
234+ 's' , 228 , "remote-port" ,
221235 & instance_config .remote .port , SOURCE_CMD , 0 ,
222236 OPTION_REMOTE_GROUP , 0 , option_get_value
223237 },
224238 {
225- 's' , 227 , "remote-path" ,
239+ 's' , 229 , "remote-path" ,
226240 & instance_config .remote .path , SOURCE_CMD , 0 ,
227241 OPTION_REMOTE_GROUP , 0 , option_get_value
228242 },
229243 {
230- 's' , 228 , "remote-user" ,
244+ 's' , 230 , "remote-user" ,
231245 & instance_config .remote .user , SOURCE_CMD , 0 ,
232246 OPTION_REMOTE_GROUP , 0 , option_get_value
233247 },
234248 {
235- 's' , 229 , "ssh-options" ,
249+ 's' , 231 , "ssh-options" ,
236250 & instance_config .remote .ssh_options , SOURCE_CMD , 0 ,
237251 OPTION_REMOTE_GROUP , 0 , option_get_value
238252 },
239253 {
240- 's' , 230 , "ssh-config" ,
254+ 's' , 232 , "ssh-config" ,
241255 & instance_config .remote .ssh_config , SOURCE_CMD , 0 ,
242256 OPTION_REMOTE_GROUP , 0 , option_get_value
243257 },
@@ -388,6 +402,8 @@ readInstanceConfigFile(InstanceState *instanceState)
388402 InstanceConfig * instance = pgut_new (InstanceConfig );
389403 char * log_level_console = NULL ;
390404 char * log_level_file = NULL ;
405+ char * log_format_console = NULL ;
406+ char * log_format_file = NULL ;
391407 char * compress_alg = NULL ;
392408 int parsed_options ;
393409
@@ -509,90 +525,100 @@ readInstanceConfigFile(InstanceState *instanceState)
509525 OPTION_LOG_GROUP , 0 , option_get_value
510526 },
511527 {
512- 's' , 214 , "log-filename" ,
528+ 's' , 214 , "log-format-console" ,
529+ & log_format_console , SOURCE_CMD_STRICT , 0 ,
530+ OPTION_LOG_GROUP , 0 , option_get_value
531+ },
532+ {
533+ 's' , 215 , "log-format-file" ,
534+ & log_format_file , SOURCE_CMD , 0 ,
535+ OPTION_LOG_GROUP , 0 , option_get_value
536+ },
537+ {
538+ 's' , 216 , "log-filename" ,
513539 & instance -> logger .log_filename , SOURCE_CMD , 0 ,
514540 OPTION_LOG_GROUP , 0 , option_get_value
515541 },
516542 {
517- 's' , 215 , "error-log-filename" ,
543+ 's' , 217 , "error-log-filename" ,
518544 & instance -> logger .error_log_filename , SOURCE_CMD , 0 ,
519545 OPTION_LOG_GROUP , 0 , option_get_value
520546 },
521547 {
522- 's' , 216 , "log-directory" ,
548+ 's' , 218 , "log-directory" ,
523549 & instance -> logger .log_directory , SOURCE_CMD , 0 ,
524550 OPTION_LOG_GROUP , 0 , option_get_value
525551 },
526552 {
527- 'U' , 217 , "log-rotation-size" ,
553+ 'U' , 219 , "log-rotation-size" ,
528554 & instance -> logger .log_rotation_size , SOURCE_CMD , SOURCE_DEFAULT ,
529555 OPTION_LOG_GROUP , OPTION_UNIT_KB , option_get_value
530556 },
531557 {
532- 'U' , 218 , "log-rotation-age" ,
558+ 'U' , 220 , "log-rotation-age" ,
533559 & instance -> logger .log_rotation_age , SOURCE_CMD , SOURCE_DEFAULT ,
534560 OPTION_LOG_GROUP , OPTION_UNIT_MS , option_get_value
535561 },
536562 /* Retention options */
537563 {
538- 'u' , 219 , "retention-redundancy" ,
564+ 'u' , 221 , "retention-redundancy" ,
539565 & instance -> retention_redundancy , SOURCE_CMD , 0 ,
540566 OPTION_RETENTION_GROUP , 0 , option_get_value
541567 },
542568 {
543- 'u' , 220 , "retention-window" ,
569+ 'u' , 222 , "retention-window" ,
544570 & instance -> retention_window , SOURCE_CMD , 0 ,
545571 OPTION_RETENTION_GROUP , 0 , option_get_value
546572 },
547573 {
548- 'u' , 221 , "wal-depth" ,
574+ 'u' , 223 , "wal-depth" ,
549575 & instance -> wal_depth , SOURCE_CMD , 0 ,
550576 OPTION_RETENTION_GROUP , 0 , option_get_value
551577 },
552578 /* Compression options */
553579 {
554- 's' , 222 , "compress-algorithm" ,
580+ 's' , 224 , "compress-algorithm" ,
555581 & compress_alg , SOURCE_CMD , 0 ,
556582 OPTION_LOG_GROUP , 0 , option_get_value
557583 },
558584 {
559- 'u' , 223 , "compress-level" ,
585+ 'u' , 225 , "compress-level" ,
560586 & instance -> compress_level , SOURCE_CMD , 0 ,
561587 OPTION_COMPRESS_GROUP , 0 , option_get_value
562588 },
563589 /* Remote backup options */
564590 {
565- 's' , 224 , "remote-proto" ,
591+ 's' , 226 , "remote-proto" ,
566592 & instance -> remote .proto , SOURCE_CMD , 0 ,
567593 OPTION_REMOTE_GROUP , 0 , option_get_value
568594 },
569595 {
570- 's' , 225 , "remote-host" ,
596+ 's' , 227 , "remote-host" ,
571597 & instance -> remote .host , SOURCE_CMD , 0 ,
572598 OPTION_REMOTE_GROUP , 0 , option_get_value
573599 },
574600 {
575- 's' , 226 , "remote-port" ,
601+ 's' , 228 , "remote-port" ,
576602 & instance -> remote .port , SOURCE_CMD , 0 ,
577603 OPTION_REMOTE_GROUP , 0 , option_get_value
578604 },
579605 {
580- 's' , 227 , "remote-path" ,
606+ 's' , 229 , "remote-path" ,
581607 & instance -> remote .path , SOURCE_CMD , 0 ,
582608 OPTION_REMOTE_GROUP , 0 , option_get_value
583609 },
584610 {
585- 's' , 228 , "remote-user" ,
611+ 's' , 230 , "remote-user" ,
586612 & instance -> remote .user , SOURCE_CMD , 0 ,
587613 OPTION_REMOTE_GROUP , 0 , option_get_value
588614 },
589615 {
590- 's' , 229 , "ssh-options" ,
616+ 's' , 231 , "ssh-options" ,
591617 & instance -> remote .ssh_options , SOURCE_CMD , 0 ,
592618 OPTION_REMOTE_GROUP , 0 , option_get_value
593619 },
594620 {
595- 's' , 230 , "ssh-config" ,
621+ 's' , 232 , "ssh-config" ,
596622 & instance -> remote .ssh_config , SOURCE_CMD , 0 ,
597623 OPTION_REMOTE_GROUP , 0 , option_get_value
598624 },
@@ -625,6 +651,12 @@ readInstanceConfigFile(InstanceState *instanceState)
625651 if (log_level_file )
626652 instance -> logger .log_level_file = parse_log_level (log_level_file );
627653
654+ if (log_format_console )
655+ instance -> logger .log_format_console = parse_log_format (log_format_console );
656+
657+ if (log_format_file )
658+ instance -> logger .log_format_file = parse_log_format (log_format_file );
659+
628660 if (compress_alg )
629661 instance -> compress_alg = parse_compress_alg (compress_alg );
630662
@@ -649,6 +681,18 @@ assign_log_level_file(ConfigOption *opt, const char *arg)
649681 instance_config .logger .log_level_file = parse_log_level (arg );
650682}
651683
684+ static void
685+ assign_log_format_console (ConfigOption * opt , const char * arg )
686+ {
687+ instance_config .logger .log_format_console = parse_log_format (arg );
688+ }
689+
690+ static void
691+ assign_log_format_file (ConfigOption * opt , const char * arg )
692+ {
693+ instance_config .logger .log_format_file = parse_log_format (arg );
694+ }
695+
652696static void
653697assign_compress_alg (ConfigOption * opt , const char * arg )
654698{
@@ -667,6 +711,18 @@ get_log_level_file(ConfigOption *opt)
667711 return pstrdup (deparse_log_level (instance_config .logger .log_level_file ));
668712}
669713
714+ static char *
715+ get_log_format_console (ConfigOption * opt )
716+ {
717+ return pstrdup (deparse_log_format (instance_config .logger .log_format_console ));
718+ }
719+
720+ static char *
721+ get_log_format_file (ConfigOption * opt )
722+ {
723+ return pstrdup (deparse_log_format (instance_config .logger .log_format_file ));
724+ }
725+
670726static char *
671727get_compress_alg (ConfigOption * opt )
672728{
0 commit comments