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

Add options to LogAction() so it can append (instead of truncate) and… #4329

Merged
merged 3 commits into from Aug 19, 2016

Conversation

Projects
None yet
2 participants
@wessels

wessels commented Aug 17, 2016

… write without buffering.

Was so happy to discover LogAction() but disappointed that it truncates
the file each time the process starts, and apparently doesn't flush the
file upon exiting. With two new optional args, the file can be appended
rather than truncated and buffering disabled. The defaults remain as
before, which is to say to truncate and to buffer.

wessels
Add options to LogAction() so it can append (instead of truncate) and…
… write without buffering.

Was so happy to discover LogAction() but disappointed that it truncates
the file each time the process starts, and apparently doesn't flush the
file upon exiting.  With two new optional args, the file can be appended
rather than truncated and buffering disabled.  The defaults remain as
before, which is to say to truncate and to buffer.
@@ -1257,7 +1257,7 @@ instantiate a server with additional parameters
* `DelayAction(milliseconds)`: delay the response by the specified amount of milliseconds (UDP-only)
* `DisableValidationAction()`: set the CD bit in the question, let it go through
* `DropAction()`: drop these packets
* `LogAction([filename], [binary])`: Log a line for each query, to the specified file if any, to the console (require verbose) otherwise. When logging to a file, the `binary` optional parameter specifies whether we log in binary form (default) or in textual form
* `LogAction([filename], [binary])`: Log a line for each query, to the specified file if any, to the console (require verbose) otherwise. When logging to a file, the `binary` optional parameter specifies whether we log in binary form (default) or in textual form, the `append` optional parameter specifies whether we open the file for appending or truncate each time (default), and the `buffered` optional parameter specifies whether writes to the file are buffered (default) or not.

This comment has been minimized.

@rgacogne

rgacogne Aug 18, 2016

Member

The parameters have not been updated in the prototype here.

This comment has been minimized.

@wessels

wessels Aug 18, 2016

Thanks, I missed that. Its added now.

@@ -913,6 +918,8 @@ private:
string d_fname;
FILE* d_fp{0};
bool d_binary{true};
bool d_append{false};
bool d_buffered{true};

This comment has been minimized.

@rgacogne

rgacogne Aug 18, 2016

Member

It looks like we don't need to keep d_append and d_buffered around, since they seem to be only used in the constructor.

This comment has been minimized.

@wessels

wessels Aug 18, 2016

Yes, thanks for the suggestion.

wessels added some commits Aug 18, 2016

wessels
@rgacogne

This comment has been minimized.

Member

rgacogne commented Aug 19, 2016

Thank you!

@rgacogne rgacogne merged commit 39368ff into PowerDNS:master Aug 19, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment