1 /***************************************************************************
2 * Copyright (C) 2005 by Dominic Rath *
3 * Dominic.Rath@gmx.de *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
25 #include "configuration.h"
35 static FILE* log_output
;
38 static void *privData
;
39 static logCallback callback
;
41 void log_setCallback(logCallback c
, void *p
)
47 static char *log_strings
[4] =
55 void log_printf(enum log_levels level
, const char *file
, int line
, const char *function
, const char *format
, ...)
62 if (level
> debug_level
)
65 va_start(args
, format
);
66 vsnprintf(buffer
, 512, format
, args
);
68 char *f
= strrchr(file
, '/');
72 fprintf(log_output
, "%s %d %ld %s:%d %s(): %s\n", log_strings
[level
], count
, time(NULL
), file
, line
, function
, buffer
);
77 /* Never forward LOG_DEBUG, too verbose and they can be found in the log if need be */
78 if (callback
&& (level
<= LOG_INFO
))
80 va_start(args
, format
);
81 callback(privData
, file
, line
, function
, format
, args
);
86 /* change the current debug level on the fly
89 * 2: + INFORMATIONAL MSGS
92 int handle_debug_level_command(struct command_context_s
*cmd_ctx
, char *cmd
, char **args
, int argc
)
95 command_print(cmd_ctx
, "debug_level: %i", debug_level
);
98 debug_level
= strtoul(args
[0], NULL
, 0);
109 int handle_log_output_command(struct command_context_s
*cmd_ctx
, char *cmd
, char **args
, int argc
)
113 FILE* file
= fopen(args
[0], "w");
124 int log_register_commands(struct command_context_s
*cmd_ctx
)
126 register_command(cmd_ctx
, NULL
, "log_output", handle_log_output_command
,
127 COMMAND_ANY
, "redirect logging to <file> (default: stderr)");
128 register_command(cmd_ctx
, NULL
, "debug_level", handle_debug_level_command
,
129 COMMAND_ANY
, "adjust debug level <0-3>");
134 int log_init(struct command_context_s
*cmd_ctx
)
136 /* set defaults for daemon configuration, if not set by cmdline or cfgfile */
137 if (debug_level
== -1)
138 debug_level
= LOG_INFO
;
140 if (log_output
== NULL
)
148 int set_log_output(struct command_context_s
*cmd_ctx
, FILE *output
)
154 /* return allocated string w/printf() result */
155 char *allocPrintf(const char *fmt
, va_list ap
)
159 /* start by 0 to exercise all the code paths. Need minimum 2 bytes to
160 * fit 1 char and 0 terminator. */
165 if ((string
== NULL
) || (!first
))
169 string
= realloc(string
, size
);
179 ret
= vsnprintf(string
, size
, fmt
, ap
);
180 /* NB! The result of the vsnprintf() might be an *EMPTY* string! */
181 if ((ret
>= 0) && ((ret
+ 1) < size
))
185 /* there was just enough or not enough space, allocate more. */
Linking to existing account procedure
If you already have an account and want to add another login method
you
MUST first sign in with your existing account and
then change URL to read
https://review.openocd.org/login/?link
to get to this page again but this time it'll work for linking. Thank you.
SSH host keys fingerprints
1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=.. |
|+o.. . |
|*.o . . |
|+B . . . |
|Bo. = o S |
|Oo.+ + = |
|oB=.* = . o |
| =+=.+ + E |
|. .=o . o |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)