PostgreSQL Source Code: src/backend/utils/error/jsonlog.c Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
17
30
32 bool escape_key,
34
35
36
37
38
39
40
41
42static void
44 bool escape_value)
45{
47
48 if (value == NULL)
49 return;
50
54
55 if (escape_value)
57 else
59}
60
61
62
63
64
65
66
67
68
69static void
71 bool escape_key, const char *fmt,...)
72{
73 int save_errno = errno;
74 size_t len = 128;
76
77 for (;;)
78 {
80 size_t newlen;
81
82
84
85
86 errno = save_errno;
87 va_start(args, fmt);
90
91 if (newlen < len)
92 break;
93
94
96 len = newlen;
97 }
98
100
101
103}
104
105
106
107
108void
110{
113 char *log_time;
114
115
116 static long log_line_number = 0;
117
118
119 static int log_my_pid = 0;
120
121
122
123
124
125
127 {
128 log_line_number = 0;
131 }
132 log_line_number++;
133
135
136
138
139
141
142
143
144
145
149
150
153
154
157
158
161
162
164 {
168 }
169
170
173
174
176
177
179 {
181 const char *psdisp;
182 int displen;
183
188
190 }
191
192
195
196
197
201
202
205
206
210
211
215
216
218
219
222 else
224
225
226 if (edata->hint)
228
229
232 true);
233
234
238
239
242
243
245 {
250 }
251
252
254 {
258 {
262 }
263 }
264
265
268
269
271
272
274 {
276
277
278
279
280
283 leader->pid);
284 }
285
286
289
290
293
294
297 else
299
301}
uint64 pgstat_get_my_query_id(void)
#define pg_attribute_printf(f, a)
bool check_log_of_query(ErrorData *edata)
const char * error_severity(int elevel)
char * get_formatted_start_time(void)
void write_pipe_chunks(char *data, int len, int dest)
const char * get_backend_type_for_log(void)
char * get_formatted_log_time(void)
char * unpack_sql_state(int sql_state)
void reset_formatted_start_time(void)
#define LOG_DESTINATION_JSONLOG
Assert(PointerIsAligned(start, uint64))
void escape_json(StringInfo buf, const char *str)
void write_jsonlog(ErrorData *edata)
static void static void appendJSONKeyValue(StringInfo buf, const char *key, const char *value, bool escape_value)
static void appendJSONKeyValueFmt(StringInfo buf, const char *key, bool escape_key, const char *fmt,...) pg_attribute_printf(4
void pfree(void *pointer)
BackendType MyBackendType
const char * debug_query_string
#define INVALID_PROC_NUMBER
const char * get_ps_display(int *displen)
size_t pvsnprintf(char *buf, size_t len, const char *fmt, va_list args)
void appendBinaryStringInfo(StringInfo str, const void *data, int datalen)
void appendStringInfoString(StringInfo str, const char *s)
void appendStringInfoChar(StringInfo str, char ch)
void initStringInfo(StringInfo str)
void write_syslogger_file(const char *buffer, int count, int destination)
TransactionId GetTopTransactionIdIfAny(void)