koopjs / koop

Transform, query, and download geospatial data on the web.
http://koopjs.github.io
Other
651 stars 125 forks source link

Logger is no longer parsing the log path correctly #218

Closed chelm closed 8 years ago

chelm commented 8 years ago

This line https://github.com/koopjs/koop/blob/master/lib/Logger.js#L11 has broke some of the provider tests.

The issue (I'm suspecting) is that splice call is not returning what we think it should return.

chelm commented 8 years ago

cc @ngoldman

chelm commented 8 years ago

The previous version of the logger used this (ugly solution on purpose...)

var logpath = config.logfile.split('/')
    logpath.splice(-1,1)
    logpath = logpath.join('/')

This correctly removes the file name and gets the base url. I think the better solution would be to pop() and rejoin the array.

chelm commented 8 years ago

actually the correct thing to do is s/splice/slice/

ungoldman commented 8 years ago

Would probably be best to use something like https://nodejs.org/api/path.html#path_path_parse_pathstring rather than doing a lot of manual string manipulation to figure out the path

chelm commented 8 years ago

oh good call @ngoldman

dmfenton commented 8 years ago

psh fancy high-falutin stdlib

ungoldman commented 8 years ago

path.parse, path.format, and path.join are pretty handy for dealing with path stuff and they work cross-platform (linux, os x, win)