Skip to content

Silent CLI option broken #181

Closed
Closed
@xtianjohns

Description

@xtianjohns

352ee1c introduced common-style changes that break the server if passed silent flags. I believe that this is because initialization of the logger object here only occurs if someone has not passed a silent flag.

Upon startup, however, the server logs that it has started.

This will throw an error.

$ http-server -s

/usr/local/lib/node_modules/http-server/bin/http-server:112
    logger.info('Starting up http-server, serving '.yellow
           ^
TypeError: Object #<Object> has no method 'info'
    at Server.<anonymous> (/usr/local/lib/node_modules/http-server/bin/http-server:112:12)
    at Server.g (events.js:180:16)
    at Server.emit (events.js:92:17)
    at net.js:1056:10
    at process._tickCallback (node.js:448:13)
    at Function.Module.runMain (module.js:499:11)
    at startup (node.js:119:16)
    at node.js:935:3

It seems like a simple fix would be to suppress the logging call inside some block that consults the arguments. An alternative might be to reconsider the implementation of the logger object.

Reproduced on 0.8.2, 0.8.3, and 0.8.4 with node v0.10.38.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions