@@ -28,10 +28,12 @@ static void (*log_locus_callback) (const char **, uint64 *);
28
28
29
29
static const char * sgr_error = NULL ;
30
30
static const char * sgr_warning = NULL ;
31
+ static const char * sgr_note = NULL ;
31
32
static const char * sgr_locus = NULL ;
32
33
33
34
#define SGR_ERROR_DEFAULT "01;31"
34
35
#define SGR_WARNING_DEFAULT "01;35"
36
+ #define SGR_NOTE_DEFAULT "01;36"
35
37
#define SGR_LOCUS_DEFAULT "01"
36
38
37
39
#define ANSI_ESCAPE_FMT "\x1b[%sm"
@@ -134,6 +136,8 @@ pg_logging_init(const char *argv0)
134
136
sgr_error = strdup (value );
135
137
if (strcmp (name , "warning" ) == 0 )
136
138
sgr_warning = strdup (value );
139
+ if (strcmp (name , "note" ) == 0 )
140
+ sgr_note = strdup (value );
137
141
if (strcmp (name , "locus" ) == 0 )
138
142
sgr_locus = strdup (value );
139
143
}
@@ -146,6 +150,7 @@ pg_logging_init(const char *argv0)
146
150
{
147
151
sgr_error = SGR_ERROR_DEFAULT ;
148
152
sgr_warning = SGR_WARNING_DEFAULT ;
153
+ sgr_note = SGR_NOTE_DEFAULT ;
149
154
sgr_locus = SGR_LOCUS_DEFAULT ;
150
155
}
151
156
}
@@ -281,10 +286,18 @@ pg_log_generic_v(enum pg_log_level level, enum pg_log_part part,
281
286
}
282
287
break ;
283
288
case PG_LOG_DETAIL :
289
+ if (sgr_note )
290
+ fprintf (stderr , ANSI_ESCAPE_FMT , sgr_note );
284
291
fprintf (stderr , _ ("detail: " ));
292
+ if (sgr_note )
293
+ fprintf (stderr , ANSI_ESCAPE_RESET );
285
294
break ;
286
295
case PG_LOG_HINT :
296
+ if (sgr_note )
297
+ fprintf (stderr , ANSI_ESCAPE_FMT , sgr_note );
287
298
fprintf (stderr , _ ("hint: " ));
299
+ if (sgr_note )
300
+ fprintf (stderr , ANSI_ESCAPE_RESET );
288
301
break ;
289
302
}
290
303
}
0 commit comments