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

Make FileLogWriter, which writes json-formatted log lines to a specified file. #313

Merged
merged 1 commit into from
Mar 11, 2016

Conversation

EvanKrall
Copy link
Member

This depends on #281 and fixes #64.

This branch makes another LogWriter implementation: file, which writes to a specified file. I expect most people to want the file opened in append mode, so I've set that as the default.

It also allows you to format the path based on service / component / level / cluster / instance, in case you want different files per service or something.

cc @hashbrowncipher for sanity-checking my usage of flock and io.

@hashbrowncipher
Copy link

shipit. either with or without flock.

# https://docs.python.org/2/library/io.html#io.FileIO
# http://article.gmane.org/gmane.linux.kernel/43445

to_write = format_log_line(level, cluster, service, instance, component, line) + self.line_delimeter
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"%s%s" % (format_log_line(level, cluster, service, instance, component, line), self.line_delimeter)

@Rob-Johnson
Copy link
Contributor

ship

@EvanKrall EvanKrall force-pushed the file_log_writer branch 2 times, most recently from 9153637 to 3a30b30 Compare March 11, 2016 00:42
@solarkennedy
Copy link
Contributor

ship

@EvanKrall EvanKrall merged commit c09cf6f into log_systems Mar 11, 2016
@asottile asottile deleted the file_log_writer branch May 31, 2016 21:46
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.

4 participants