Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@oleksiyk
Copy link
Contributor

This makes nodeftpd to log messages like this:

log-1
log-2

Each message consists of 5 space separated fields:

  • date time in ISO8601 format (YYYY-MM-DDTHH:mm:ss.sssZ)
  • message level (ERROR, WARN, DEBUG, TRACE, INFO)
  • remote IP or '-'
  • authenticated user or '-'
  • free text message

Messages are logged in color to TTY and without any color escape sequences when stdout/stderr is redirected to file.

Several new options added:

  • ttyColors: boolean, set to false to force disable coloured output
  • logFunction: function, overwrite default function used to log messages. Receives 4 arguments: level, remote ip, authenticated user, message.

logLevel option remains the same: from 0 (just errors) to 4 (trace)

I've also used sinon to verify logged messages in some tests instead of old method:
oleksiyk@df873e5#diff-51ecdc1506ecf5aaebb57c019653fbe6L124

Logging level can also be redefined with NODEFTPD_LOG_LEVEL environment variable.

@oleksiyk oleksiyk force-pushed the better-logging branch 2 times, most recently from 75a6ce4 to 94ebd46 Compare February 13, 2016 22:03
@sstur
Copy link
Collaborator

sstur commented Feb 13, 2016

Hi @oleksiyk. Thanks for this work on logging! I'm in the process of a big refactor using ES6 and adding a better abstraction around active/passive data connections. I can take a closer look at this diff soon and possibly merge it into master, but I think the new branch will actually become the master branch in the near future, so we may need to manually add this feature to that branch at some point.

https://github.com/sstur/nodeftpd/tree/refactor

@oleksiyk
Copy link
Contributor Author

Hi Simon!
So support for Node 0.10 will be dropped?

@sstur
Copy link
Collaborator

sstur commented Feb 14, 2016

No, not dropping support for v0.10.

I'll continue to support all the versions we support now. The ES6 features will be transformed to valid ES5 before publishing to NPM.

@oleksiyk
Copy link
Contributor Author

Ok, let me know what you decide. I will adapt this one for ES6 branch or create new PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants