summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libguile-ssh/error.c10
-rw-r--r--libguile-ssh/log.c19
-rw-r--r--libguile-ssh/log.h3
3 files changed, 22 insertions, 10 deletions
diff --git a/libguile-ssh/error.c b/libguile-ssh/error.c
index 0f1fb53..34782c0 100644
--- a/libguile-ssh/error.c
+++ b/libguile-ssh/error.c
@@ -36,18 +36,10 @@ guile_ssh_error (const char *proc, const char *msg, SCM args, SCM rest)
void
guile_ssh_error1 (const char *proc, const char *msg, SCM args)
{
- char *c_str;
- scm_dynwind_begin (0);
-
- c_str = scm_to_locale_string (scm_object_to_string (args, SCM_UNDEFINED));
- scm_dynwind_free (c_str);
-
- _ssh_log (SSH_LOG_RARE, proc, "%s: %s", msg, c_str);
+ _gssh_log_error (proc, msg, args);
scm_error (scm_from_locale_symbol (GUILE_SSH_ERROR), proc, msg, args,
SCM_BOOL_F);
-
- scm_dynwind_end ();
}
/* Report a session error. */
diff --git a/libguile-ssh/log.c b/libguile-ssh/log.c
index cdc1450..c631306 100644
--- a/libguile-ssh/log.c
+++ b/libguile-ssh/log.c
@@ -1,6 +1,6 @@
/* log.c -- Guile-SSH logging procedures
*
- * Copyright (C) 2014 Artyom V. Poptsov <poptsov.artyom@gmail.com>
+ * Copyright (C) 2014, 2015, 2016, 2017 Artyom V. Poptsov <poptsov.artyom@gmail.com>
*
* This file is part of Guile-SSH
*
@@ -239,6 +239,23 @@ Get global log verbosity value.\
}
+/* Write an error MESSAGE along with ARGS to the libssh log. */
+void
+_gssh_log_error (const char* function_name, const char* msg, SCM args)
+{
+ char *c_str;
+ scm_dynwind_begin (0);
+
+ c_str = scm_to_locale_string (scm_object_to_string (args, SCM_UNDEFINED));
+ scm_dynwind_free (c_str);
+
+ _ssh_log (SSH_LOG_NOLOG, function_name, "[GSSH ERROR] %s: %s",
+ msg, c_str);
+
+ scm_dynwind_end ();
+}
+
+
/* Initialization */
void
diff --git a/libguile-ssh/log.h b/libguile-ssh/log.h
index 8e49199..b4ffbb0 100644
--- a/libguile-ssh/log.h
+++ b/libguile-ssh/log.h
@@ -18,6 +18,9 @@
extern struct symbol_mapping log_verbosity[];
+extern void _gssh_log_error (const char* function_name, const char* msg,
+ SCM args);
+
extern void init_log_func (void);
/* log.h ends here */