Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
configuration
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
configuration
Commits
cf8c0aa9
Commit
cf8c0aa9
authored
Jul 25, 2016
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract a baseclass for Formatters
parent
f0ae1358
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
9 deletions
+8
-9
playbooks/callback_plugins/task_timing.py
+8
-9
No files found.
playbooks/callback_plugins/task_timing.py
View file @
cf8c0aa9
...
...
@@ -34,10 +34,15 @@ class Timestamp(object):
return
self
.
end
-
self
.
start
class
Datadog
Formatter
(
object
):
class
Formatter
(
object
):
def
__init__
(
self
,
callback_module
):
self
.
callback_module
=
callback_module
class
DatadogFormatter
(
Formatter
):
def
__init__
(
self
,
callback_module
):
super
(
DatadogFormatter
,
self
)
.
__init__
(
callback_module
)
self
.
datadog_api_key
=
os
.
getenv
(
'DATADOG_API_KEY'
)
self
.
datadog_api_initialized
=
False
...
...
@@ -82,10 +87,7 @@ class DatadogFormatter(object):
logger
.
error
(
ex
.
message
)
class
JsonFormatter
(
object
):
def
__init__
(
self
,
callback_module
):
self
.
callback_module
=
callback_module
class
JsonFormatter
(
Formatter
):
def
log_tasks
(
self
,
playbook_name
,
results
):
if
ANSIBLE_TIMER_LOG
is
not
None
:
log_path
=
self
.
callback_module
.
playbook_timestamp
.
start
.
strftime
(
ANSIBLE_TIMER_LOG
)
...
...
@@ -138,10 +140,7 @@ class JsonFormatter(object):
outfile
.
write
(
'
\n
'
)
class
LoggingFormatter
(
object
):
def
__init__
(
self
,
callback_module
):
self
.
callback_module
=
callback_module
class
LoggingFormatter
(
Formatter
):
def
log_tasks
(
self
,
playbook_name
,
results
):
for
name
,
timestamp
in
results
[:
10
]:
logger
.
info
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment