Permalink
Browse files

fix build for node-gyp and remove deprecated code

  • Loading branch information...
1 parent f1d550a commit f42bd3779809cd54a56390f04303a30fd1bc445e @schamane committed Jul 9, 2012
Showing with 19 additions and 84 deletions.
  1. +5 −0 Changelog.md
  2. +4 −6 README.md
  3. +0 −5 node-syslog.h
  4. +2 −2 node-syslog.js
  5. +6 −9 package.json
  6. +2 −31 syslog.cc
  7. +0 −31 wscript
View
@@ -1,3 +1,8 @@
+##1.1.5
+
+* remove old nodejs version support prior to 0.8.0
+* fix building
+
## 1.1.4
* Cleaned all opened and not closed ScopeHandlers
View
@@ -1,14 +1,14 @@
# Node-Syslog
-v1.1.4
+v1.1.5
This is an node module (add-on) to work with system log daemon on unix systems.
-Module is tested with node.js v0.3.3 and metalog, syslog-ng 3.1.1.
+Module is tested with node.js v0.8.1 and metalog, syslog-ng 3.1.1.
Read Wiki "setMask" page for more information about how to use "setMask" functionality.
-Current version is compatible to node 0.4.x and higher versions. For older nodejs versions please use node-syslog v1.0.2
+Current version is compatible to node 0.8.x and higher versions. For older nodejs versions please use node-syslog v1.0.3
Node-syslog doesn't support Darwin OS and MS Windows, but should work fine with this OSes.
@@ -26,14 +26,12 @@ Node-syslog doesn't support Darwin OS and MS Windows, but should work fine with
### manual
git clone
- node-waf configure build
+ node-gyp configure build
## Usage
For more inforamtion about how to use module check test.js
- #!/bin/env node
-
var Syslog = require('node-syslog');
Syslog.init("node-syslog", Syslog.LOG_PID | Syslog.LOG_ODELAY, Syslog.LOG_LOCAL0);
View
@@ -1,19 +1,14 @@
#ifndef syslog_h
#define syslog_h
-#define NODE_AT_LEAST_6 (NODE_VERSION_AT_LEAST(0, 6, 0))
-
#include <node.h>
#include <node_object_wrap.h>
#include <node_version.h>
#include <v8.h>
#include <syslog.h>
#include <stdlib.h>
#include <string.h>
-
-#if NODE_AT_LEAST_6
#include <uv.h>
-#endif
namespace node {
View
@@ -1,6 +1,6 @@
(function(){
-var SyslogWrapper = require('./syslog').Syslog;
+var SyslogWrapper = require('./build/Release/syslog').Syslog;
/*
* export Syslog as module
@@ -11,7 +11,7 @@ init: SyslogWrapper.init,
log: SyslogWrapper.log,
setMask: SyslogWrapper.setMask,
close: SyslogWrapper.close,
-version: '1.1.4',
+version: '1.1.5',
/*
* facilities
View
@@ -1,12 +1,9 @@
{
"name": "node-syslog",
- "version": "1.1.4",
- "directories": {
- "lib": "./lib"
- },
+ "version": "1.1.5",
"main": "./node-syslog",
"engines": {
- "node" : ">=0.4.0"
+ "node" : ">=0.8.0"
},
"description": "Node module to support sending messages to syslog daemon",
"author": "Nazar Kulyk <nasar.kulyk@googlemail.com>",
@@ -17,12 +14,12 @@
"url" : "git@github.com:schamane/node-syslog.git"
},
"bugs": {
- "url": "https://github.com/schamane/node-syslog/issues"
- },
+ "url": "https://github.com/schamane/node-syslog/issues"
+ },
"licenses": [
{
- "type": "Simplified BSD License",
- "url": "http://en.wikipedia.org/wiki/BSD_licenses"
+ "type": "Simplified BSD License",
+ "url": "http://en.wikipedia.org/wiki/BSD_licenses"
}],
"tags": ["syslog", "system", "log", "logging"]
}
View
@@ -3,9 +3,6 @@
using namespace v8;
using namespace node;
-#define NODE_LESS_THAN_5 (!(NODE_VERSION_AT_LEAST(0, 5, 4)))
-#define NODE_LESS_THAN_6 (!(NODE_VERSION_AT_LEAST(0, 6, 0)))
-
Persistent<FunctionTemplate> Syslog::constructor_template;
bool Syslog::connected_ = false;
char Syslog::name[1024];
@@ -59,44 +56,21 @@ struct log_request {
uint32_t log_level;
};
-#if !NODE_LESS_THAN_6
static void UV_AfterLog(uv_work_t *req) {
-#else
-static int EIO_AfterLog( eio_req *req) {
-#endif
struct log_request *log_req = (struct log_request *)(req->data);
log_req->cb.Dispose(); // is this necessary?
free(log_req->msg);
free(log_req);
delete req;
-#if NODE_LESS_THAN_6
- ev_unref(EV_DEFAULT_UC);
-#endif
-#if NODE_LESS_THAN_5
- return 0;
-#endif
}
-#if !NODE_LESS_THAN_6
static void UV_Log(uv_work_t *req) {
-#elif !NODE_LESS_THAN_5
-static void EIO_Log(eio_req *req) {
-#else
-static int EIO_Log(eio_req *req) {
-#endif
struct log_request *log_req = (struct log_request *)(req->data);
char *msg = log_req->msg;
syslog(log_req->log_level, "%s", msg);
-#if NODE_LESS_THAN_6
- req->result = 0;
-#endif
-#if NODE_LESS_THAN_5
- return 0;
-#else
return;
-#endif
}
Handle<Value>
@@ -124,14 +98,11 @@ Syslog::log ( const Arguments& args)
log_req->cb = Persistent<Function>::New(cb);
log_req->msg = strdup(*msg);
log_req->log_level = log_level;
-#if NODE_LESS_THAN_6
- eio_custom(EIO_Log, EIO_PRI_DEFAULT, EIO_AfterLog, log_req);
- ev_ref(EV_DEFAULT_UC);
-#else
+
uv_work_t *work_req = new uv_work_t();
work_req->data = log_req;
uv_queue_work(uv_default_loop(), work_req, UV_Log, UV_AfterLog);
-#endif
+
return scope.Close(Undefined());
}
View
@@ -1,31 +0,0 @@
-import Options
-from os import unlink, symlink, popen
-from os.path import exists
-
-srcdir = '.'
-blddir = 'build'
-VERSION = '1.1.4'
-
-def set_options(opt):
- opt.tool_options('compiler_cxx')
-
-def configure(conf):
- conf.check_tool('compiler_cxx')
- conf.check_tool('node_addon')
-
-def build(bld):
- obj = bld.new_task_gen('cxx', 'shlib', 'node_addon')
- obj.target = 'syslog'
- obj.source = 'syslog.cc'
-
-def shutdown():
- # HACK to get syslog.node out of build directory.
- # better way to do this?
- if Options.commands['clean']:
- if exists('syslog.node'): unlink('syslog.node')
- else:
- if exists('build/default/syslog.node') and not exists('syslog.node'):
- symlink('build/default/syslog.node', 'syslog.node')
- else:
- if exists('build/Release/syslog.node') and not exists('syslog.node'):
- symlink('build/Release/syslog.node', 'syslog.node')

0 comments on commit f42bd37

Please sign in to comment.