]> err.no Git - scalable-opengroupware.org/commitdiff
syslog appender, notes/readme updated
authorznek <znek@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Thu, 27 May 2004 14:00:27 +0000 (14:00 +0000)
committerznek <znek@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Thu, 27 May 2004 14:00:27 +0000 (14:00 +0000)
git-svn-id: http://svn.opengroupware.org/SOGo/trunk@9 d1b88da0-ebda-0310-925b-ed51d893ca5b

WebUI/ChangeLog
WebUI/NGExtensions/NGLogging/ChangeLog [new file with mode: 0644]
WebUI/NGExtensions/NGLogging/NGLogSyslogAppender.h [new file with mode: 0644]
WebUI/NGExtensions/NGLogging/NGLogSyslogAppender.m [new file with mode: 0644]
WebUI/NOTES
WebUI/README
WebUI/WebUI.xcode/project.pbxproj

index 07ff8b463ea47d76a0af153fba2d4c08407fdd35..dec9a5628bf9accd35893c03dc659cdf8a3e59d2 100644 (file)
@@ -1,3 +1,9 @@
+2004-05-27  Marcus Mueller  <mm@skyrix.com>
+
+       * README, NOTES: updated
+
+       * NGExtensions/NGLogging/ChangeLog: created
+
 2004-05-26  Marcus Mueller  <mm@skyrix.com>
 
        * ChangeLog: created
diff --git a/WebUI/NGExtensions/NGLogging/ChangeLog b/WebUI/NGExtensions/NGLogging/ChangeLog
new file mode 100644 (file)
index 0000000..ef2c49c
--- /dev/null
@@ -0,0 +1,5 @@
+2004-05-27  Marcus Mueller  <mm@skyrix.com>
+
+       * NGLogSyslogAppender.[hm]: syslog appender, untested.
+
+       * ChangeLog: created
diff --git a/WebUI/NGExtensions/NGLogging/NGLogSyslogAppender.h b/WebUI/NGExtensions/NGLogging/NGLogSyslogAppender.h
new file mode 100644 (file)
index 0000000..e7253b8
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+  Copyright (C) 2000-2004 SKYRIX Software AG
+
+  This file is part of OGo
+
+  OGo is free software; you can redistribute it and/or modify it under
+  the terms of the GNU Lesser General Public License as published by the
+  Free Software Foundation; either version 2, or (at your option) any
+  later version.
+
+  OGo is distributed in the hope that it will be useful, but WITHOUT ANY
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+  License for more details.
+
+  You should have received a copy of the GNU Lesser General Public
+  License along with OGo; see the file COPYING.  If not, write to the
+  Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+  02111-1307, USA.
+*/
+// $Id$
+
+
+#ifndef        __NGLogSyslogAppender_H_
+#define        __NGLogSyslogAppender_H_
+
+
+#import "NGLogAppender.h"
+
+
+@interface NGLogSyslogAppender : NGLogAppender
+{
+
+}
+
++ (id)sharedAppender;
+
+/* provide syslog identifier */
+- (id)initWithIdentifier:(NSString *)_ident;
+
+@end
+
+#endif /* __NGLogSyslogAppender_H_ */
diff --git a/WebUI/NGExtensions/NGLogging/NGLogSyslogAppender.m b/WebUI/NGExtensions/NGLogging/NGLogSyslogAppender.m
new file mode 100644 (file)
index 0000000..f9b7dc3
--- /dev/null
@@ -0,0 +1,112 @@
+/*
+  Copyright (C) 2000-2004 SKYRIX Software AG
+
+  This file is part of OGo
+
+  OGo is free software; you can redistribute it and/or modify it under
+  the terms of the GNU Lesser General Public License as published by the
+  Free Software Foundation; either version 2, or (at your option) any
+  later version.
+
+  OGo is distributed in the hope that it will be useful, but WITHOUT ANY
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+  License for more details.
+
+  You should have received a copy of the GNU Lesser General Public
+  License along with OGo; see the file COPYING.  If not, write to the
+  Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+  02111-1307, USA.
+*/
+// $Id$
+
+
+#import "NGLogSyslogAppender.h"
+#import "NGLogEvent.h"
+#include <syslog.h>
+#include <stdarg.h>
+
+
+@interface NGLogSyslogAppender (PrivateAPI)
+- (int)syslogPriorityForLogLevel:(NGLogLevel)_level;
+@end
+
+@implementation NGLogSyslogAppender
+
+
+static NSString *defaultSyslogIdentifier = nil;
+
+
++ (void)initialize {
+  NSUserDefaults *ud;
+  static BOOL isInitialized = NO;
+
+  if(isInitialized)
+    return;
+
+  ud = [NSUserDefaults standardUserDefaults];
+  defaultSyslogIdentifier =
+    [[ud stringForKey:@"NGLogSyslogIdentifier"] retain];
+
+  isInitialized = YES;
+}
+
++ (id)sharedAppender {
+  static id sharedAppender = nil;
+  if(sharedAppender == nil) {
+    sharedAppender = [[self alloc] init];
+  }
+  return sharedAppender;
+}
+
+- (id)init {
+    return [self initWithIdentifier:defaultSyslogIdentifier];
+}
+
+- (id)initWithIdentifier:(NSString *)_ident {
+  if((self = [super init])) {
+    #warning ** default flags?
+    openlog([_ident cString], LOG_PID | LOG_NDELAY, LOG_USER);
+  }
+  return self;
+}
+
+- (void)dealloc {
+  closelog();
+  [super dealloc];
+}
+
+- (void)appendLogEvent:(NGLogEvent *)_event {
+  int level;
+    
+  level = [self syslogPriorityForLogLevel:[_event level]];
+  syslog(level, [[_event message] cString]);
+}
+
+- (int)syslogLevelForLogLevel:(NGLogLevel)_level {
+    int level;
+    
+    switch (_level) {
+        case NGLogLevelDebug:
+            level = LOG_DEBUG;
+            break;
+        case NGLogLevelInfo:
+            level = LOG_INFO;
+            break;
+        case NGLogLevelWarn:
+            level = LOG_WARNING;
+            break;
+        case NGLogLevelError:
+            level = LOG_ERR;
+            break;
+        case NGLogLevelFatal:
+            level = LOG_ALERT; // LOG_EMERG is broadcast to all users...
+            break;
+        default:
+            level = LOG_NOTICE;
+            break;
+    }
+    return level;
+}
+
+@end
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..e42d00501aba74561671153f28abdb2f1f863e60 100644 (file)
@@ -0,0 +1,14 @@
+$Id$
+
+- NGExtensions
+  - Stuff I believe might be useful for later addition to NGExtensions framework
+
+  - NGLogging
+    - Had a look at log4cocoa, appeared to be too bloated (they mimic all of
+      log4j which doesn't really make sense in Objective-C).
+    - NGLogConsoleAppender is the only appender currently available, it's
+      hardcoded in NGLogger as default. This should change as soon as we have
+      a config for that purpose. Logging is low priority, so we don't need to
+      do that too soon.
+    - Syslog appender might be useful for the ministry. Syslog provides its own
+      buffering, so syslog appender should be straight forward.
\ No newline at end of file
index 591cb493e8d8240c868c05fa69fb44870cd2093a..2c79e7081a0f40f59fb12ed2a1c3206790ec3422 100644 (file)
@@ -1,16 +1,24 @@
 $Id$
 
 
+WebUI
+  Part of SOGo
+  Copyright (C) 2000-2004 SKYRIX Software AG - http://www.skyrix.com/
 
-Xcode notes:
+Subprojects
+===========
+
+- NGExtensions
+  - NGLogging
+
+
+UserDefaults
 ============
 
+    Default                 | Type   | Example Value
+    =============================================================
+    NGLogSyslogIdentifier   | String | WebUI
+
+
 
-Rapid Development
-=================
 
-In order for "Rapid Development" to work properly you need to open
-Xcode's "Project" menu and select "Edit active executable"
-(Apple-Option-X). In the following dialog navigate to the "Runtime"
-section and select the "Project Directory" as the working directory
-when launching the executable.
index ac93e12f2bf521edce89bec3901a82b562482e2f..bc136fe699f434a68e3460326d2c41f1df295719 100644 (file)
                                ADC15A4F0664E25B0063754B,
                                ADC15A560664E33A0063754B,
                                AD1967250665E52400E19038,
+                               AD0618D0066610A200AC467F,
                        );
                        isa = PBXHeadersBuildPhase;
                        runOnlyForDeploymentPostprocessing = 0;
                                ADA38B8205DD238A00C820AA,
                                AD95AEBA0664BC6700FCB211,
                                AD95AEBC0664BC7B00FCB211,
+                               AD0618D50666121C00AC467F,
                        );
                        isa = PBXResourcesBuildPhase;
                        runOnlyForDeploymentPostprocessing = 0;
                                ADC15A500664E25B0063754B,
                                ADC15A570664E33A0063754B,
                                AD1967260665E52400E19038,
+                               AD0618D1066610A200AC467F,
                        );
                        isa = PBXSourcesBuildPhase;
                        runOnlyForDeploymentPostprocessing = 0;
 //AD2
 //AD3
 //AD4
+               AD0618CE066610A200AC467F = {
+                       fileEncoding = 4;
+                       isa = PBXFileReference;
+                       lastKnownFileType = sourcecode.c.h;
+                       path = NGLogSyslogAppender.h;
+                       refType = 4;
+                       sourceTree = "<group>";
+               };
+               AD0618CF066610A200AC467F = {
+                       fileEncoding = 4;
+                       isa = PBXFileReference;
+                       lastKnownFileType = sourcecode.c.objc;
+                       path = NGLogSyslogAppender.m;
+                       refType = 4;
+                       sourceTree = "<group>";
+               };
+               AD0618D0066610A200AC467F = {
+                       fileRef = AD0618CE066610A200AC467F;
+                       isa = PBXBuildFile;
+                       settings = {
+                       };
+               };
+               AD0618D1066610A200AC467F = {
+                       fileRef = AD0618CF066610A200AC467F;
+                       isa = PBXBuildFile;
+                       settings = {
+                       };
+               };
+               AD0618D40666121C00AC467F = {
+                       explicitFileType = text;
+                       fileEncoding = 4;
+                       isa = PBXFileReference;
+                       path = ChangeLog;
+                       refType = 4;
+                       sourceTree = "<group>";
+                       tabWidth = 4;
+                       usesTabs = 1;
+               };
+               AD0618D50666121C00AC467F = {
+                       fileRef = AD0618D40666121C00AC467F;
+                       isa = PBXBuildFile;
+                       settings = {
+                       };
+               };
                AD0ACCDE062732BD0054A820 = {
                        children = (
                                AD0ACCDF062733370054A820,
                        path = ChangeLog;
                        refType = 4;
                        sourceTree = "<group>";
+                       tabWidth = 4;
                        usesTabs = 1;
                };
                AD95AEBC0664BC7B00FCB211 = {
                ADC15A530664E3280063754B = {
                        children = (
                                AD1967660665FE6800E19038,
+                               AD0618D40666121C00AC467F,
                                ADC15A450664DA320063754B,
                                ADC15A410664D1D90063754B,
                                ADC15A420664D1D90063754B,
                                ADC15A4E0664E25B0063754B,
                                AD1967230665E52400E19038,
                                AD1967240665E52400E19038,
+                               AD0618CE066610A200AC467F,
+                               AD0618CF066610A200AC467F,
                        );
                        isa = PBXGroup;
                        name = Logging;