]> andersk Git - openssh.git/blame - log-client.c
- Merged more OpenBSD CVS changes:
[openssh.git] / log-client.c
CommitLineData
8efc0c15 1/*
2
3log-client.c
4
5Author: Tatu Ylonen <ylo@cs.hut.fi>
6
7Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
8 All rights reserved
9
10Created: Mon Mar 20 21:13:40 1995 ylo
11
12Client-side versions of debug(), log(), etc. These print to stderr.
6a17f9c2 13This is a stripped down version of log-server.c.
8efc0c15 14
15*/
16
17#include "includes.h"
18RCSID("$Id$");
19
20#include "xmalloc.h"
21#include "ssh.h"
22
6a17f9c2 23static LogLevel log_level = SYSLOG_LEVEL_INFO;
8efc0c15 24
6a17f9c2 25/* Initialize the log.
26 av0 program name (should be argv[0])
27 level logging level
28 */
8efc0c15 29
6a17f9c2 30void
31log_init(char *av0, LogLevel level, SyslogFacility ignored1, int ignored2)
8efc0c15 32{
6a17f9c2 33 switch (level)
8efc0c15 34 {
6a17f9c2 35 case SYSLOG_LEVEL_QUIET:
36 case SYSLOG_LEVEL_ERROR:
37 case SYSLOG_LEVEL_FATAL:
38 case SYSLOG_LEVEL_INFO:
39 case SYSLOG_LEVEL_CHAT:
40 case SYSLOG_LEVEL_DEBUG:
41 log_level = level;
42 break;
43 default:
44 /* unchanged */
45 break;
8efc0c15 46 }
8efc0c15 47}
48
6a17f9c2 49#define MSGBUFSIZE 1024
8efc0c15 50
6a17f9c2 51void
52do_log(LogLevel level, const char *fmt, va_list args)
8efc0c15 53{
6a17f9c2 54 char msgbuf[MSGBUFSIZE];
8efc0c15 55
6a17f9c2 56 if (level > log_level)
57 return;
58 if (level == SYSLOG_LEVEL_DEBUG)
59 fprintf(stderr, "debug: ");
60 vsnprintf(msgbuf, sizeof(msgbuf), fmt, args);
61 fprintf(stderr, "%s", msgbuf);
8efc0c15 62 fprintf(stderr, "\r\n");
8efc0c15 63}
This page took 0.324857 seconds and 5 git commands to generate.