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

LOGGLY-3909 Minimize logging back to Loggly. #34

Merged
merged 8 commits into from Sep 6, 2013

LOGGLY-3909 Minimize logging; change to JSON format

  • Loading branch information
♥ Ivan Tam ♥
♥ Ivan Tam ♥ committed Sep 5, 2013
commit c426b074bb174044e04a40c298b85342044c0236
@@ -312,7 +312,7 @@ def printEnvironment(current_environment):

def sendEnvironment(data):
printLog("Sending environment details to Loggly Server.")
log({"environment":data})
log(data)

def sys_exit(reason = None):
"""
@@ -1429,34 +1429,31 @@ def parse_options():

# Script starts here
def main():
printMessage("Starting")
options = parse_options()
global LOGGLY_QA
LOGGLY_QA = os.environ.get('LOGGLY_QA', '').split()
is_printLog = options.verbose
version_compatibility_check(MINIMUM_SUPPORTED_PYTHON_VERSION)

if options.action == 'loggly_help':
loggly_help()
sys.exit()

log({"status":"start", "args": vars(options)})
current_environment = get_environment_details()
current_environment['options'] = options
data = {
"operating_system": current_environment['operating_system'],
"syslog_versions": current_environment['syslog_versions']
}
sendEnvironment(data)
call_module(options.action, current_environment)
printMessage("Finished")
log({"status":"finish", "args": vars(options)})

if __name__ == "__main__":
try:
main()
printMessage("Starting")
options = parse_options()
global LOGGLY_QA
LOGGLY_QA = os.environ.get('LOGGLY_QA', '').split()
is_printLog = options.verbose
version_compatibility_check(MINIMUM_SUPPORTED_PYTHON_VERSION)

if options.action == 'loggly_help':
loggly_help()
sys.exit()

log({"status":"start", "args": vars(options)})
current_environment = get_environment_details()
current_environment['options'] = options
log({
"operating_system": current_environment['operating_system'],
"syslog_versions": [ {"daemon": d, "version": v} for d,v in current_environment['syslog_versions'] ]
})
call_module(options.action, current_environment)
printMessage("Finished")
log({"status":"finish", "args": vars(options)})
except KeyboardInterrupt:
printLog("KeyboardInterrupt")
print "\nAborting..."
log({"status":"aborted", "args": vars(options), "msg":"KeyboardInterrupt" })
except Exception as e:
try:
trace = traceback.format_exc()
@@ -1465,3 +1462,6 @@ def main():
finally:
printLog('Configure script has errors')
sys.exit(-1)

if __name__ == "__main__":
main()
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.