mirror of
https://github.com/gnustep/libs-back.git
synced 2025-02-24 04:11:28 +00:00
In gpbs, removed barely used, overly complex and almost certainly buggy logging code.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@37842 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
a35676ffaf
commit
e4dd0c00e2
2 changed files with 6 additions and 66 deletions
|
@ -1,3 +1,8 @@
|
|||
2014-05-06 Ivan Vucica <ivan@vucica.net>
|
||||
|
||||
* Tools/gpbs.m: Removed barely used, overly complex and almost
|
||||
certainly buggy logging code.
|
||||
|
||||
2014-05-05 Ivan Vucica <ivan@vucica.net>
|
||||
|
||||
* ChangeLog: Corrected year for some recent commits.
|
||||
|
|
67
Tools/gpbs.m
67
Tools/gpbs.m
|
@ -51,67 +51,9 @@
|
|||
|
||||
static BOOL is_daemon = NO; /* Currently running as daemon. */
|
||||
static BOOL auto_stop = NO; /* Stop when all connections closed. */
|
||||
static char ebuf[2048];
|
||||
|
||||
static NSMutableArray *connections = nil;
|
||||
|
||||
#ifdef HAVE_SYSLOG
|
||||
|
||||
static int log_priority = LOG_DEBUG;
|
||||
|
||||
static void
|
||||
gpbs_log (int prio)
|
||||
{
|
||||
if (is_daemon)
|
||||
{
|
||||
syslog (log_priority | prio, ebuf);
|
||||
}
|
||||
else if (prio == LOG_INFO)
|
||||
{
|
||||
write (1, ebuf, strlen (ebuf));
|
||||
write (1, "\n", 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
write (2, ebuf, strlen (ebuf));
|
||||
write (2, "\n", 1);
|
||||
}
|
||||
|
||||
if (prio == LOG_CRIT)
|
||||
{
|
||||
if (is_daemon)
|
||||
{
|
||||
syslog (LOG_CRIT, "exiting.");
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf (stderr, "exiting.\n");
|
||||
fflush (stderr);
|
||||
}
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
||||
#define LOG_CRIT 2
|
||||
#define LOG_DEBUG 0
|
||||
#define LOG_ERR 1
|
||||
#define LOG_INFO 0
|
||||
#define LOG_WARNING 0
|
||||
void
|
||||
gpbs_log (int prio)
|
||||
{
|
||||
write (2, ebuf, strlen (ebuf));
|
||||
write (2, "\n", 1);
|
||||
if (prio == LOG_CRIT)
|
||||
{
|
||||
fprintf (stderr, "exiting.\n");
|
||||
fflush (stderr);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@class PasteboardServer;
|
||||
@class PasteboardObject;
|
||||
|
||||
|
@ -1114,7 +1056,6 @@ if (beenHere == YES)
|
|||
static void
|
||||
init(int argc, char** argv, char **env)
|
||||
{
|
||||
NSUserDefaults *defs;
|
||||
NSProcessInfo *pInfo;
|
||||
NSMutableArray *args;
|
||||
unsigned count;
|
||||
|
@ -1209,19 +1150,13 @@ init(int argc, char** argv, char **env)
|
|||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
gpbs_log(LOG_CRIT);
|
||||
NSLog(@"An exception has ocurred.");
|
||||
DESTROY(t);
|
||||
}
|
||||
NS_ENDHANDLER
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Make gpbs logging go to syslog unless overridden by user.
|
||||
*/
|
||||
defs = [NSUserDefaults standardUserDefaults];
|
||||
[defs registerDefaults: [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
@"YES", @"GSLogSyslog", nil]];
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue