Permalink
Browse files

Added logger test with custom paths

  • Loading branch information...
1 parent e1ff470 commit 01a532f0a0e6adaebb3bb0ac3ee18bb9d47411f7 @tj tj committed Feb 4, 2011
Showing with 35 additions and 1 deletion.
  1. 0 test/logs/nested/.gitignore
  2. +1 −0 test/run
  3. +33 −0 test/test.logger.custom-path.js
  4. +1 −1 test/test.logger.js
No changes.
View
@@ -1,6 +1,7 @@
#!/bin/sh
rm -f logs/*.log
+rm -f logs/nested/*.log
files=test/test.*.js
for file in $files; do
@@ -0,0 +1,33 @@
+
+/**
+ * Module dependencies.
+ */
+
+var engine = require('../')
+ , should = require('../support/should')
+ , http = require('http')
+ , fs = require('fs');
+
+var server = http.createServer(function(req, res){
+ console.log('%s %s', req.method, req.url);
+ res.writeHead(200);
+ res.end('Hello World');
+});
+
+engine = engine(server)
+ .workers(1)
+ .use(engine.logger(__dirname + '/logs/nested'))
+ .listen(3000);
+
+engine.on('listening', function(){
+ http.get({ host: 'localhost', port: 3000 }, function(res){
+ res.on('end', function(){
+ var files = fs.readdirSync(__dirname + '/logs/nested');
+ files.should.have.length(4);
+ files.should.contain('master.log');
+ files.should.contain('worker.0.access.log');
+ files.should.contain('worker.0.error.log');
+ engine.close();
+ });
+ });
+});
View
@@ -23,7 +23,7 @@ engine.on('listening', function(){
http.get({ host: 'localhost', port: 3000 }, function(res){
res.on('end', function(){
var files = fs.readdirSync(__dirname + '/logs');
- files.should.have.length(4);
+ files.should.have.length(5);
files.should.contain('master.log');
files.should.contain('worker.0.access.log');
files.should.contain('worker.0.error.log');

0 comments on commit 01a532f

Please sign in to comment.