★ wanayoo — archive 1999 https://github.com/nodeftpd/nodeftpd/pull/91Nouvelle recherche | Portail wanayoo
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better logging #91

Open
wants to merge 1 commit into
base: master
from
Open

Better logging #91

wants to merge 1 commit into from

Conversation

@oleksiyk
Copy link
Contributor

oleksiyk commented Feb 13, 2016

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 oleksiyk:better-logging branch 2 times, most recently from 75a6ce4 to 94ebd46 Feb 13, 2016
@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

oleksiyk commented Feb 13, 2016

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

oleksiyk commented Feb 14, 2016

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

@oleksiyk oleksiyk force-pushed the oleksiyk:better-logging branch from 94ebd46 to 09016d8 Feb 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.