Logs¶
- cloudify.logs.message_context_from_cloudify_context(ctx)[source]¶
Build a message context from a CloudifyContext instance
- cloudify.logs.message_context_from_workflow_context(ctx)[source]¶
Build a message context from a CloudifyWorkflowContext instance
- cloudify.logs.message_context_from_workflow_node_instance_context(ctx)[source]¶
Build a message context from a CloudifyWorkflowNode instance
- class cloudify.logs.CloudifyBaseLoggingHandler(ctx, out_func, message_context_builder)[source]¶
Bases:
Handler
A base handler class for writing log messages to RabbitMQ
- class cloudify.logs.CloudifyPluginLoggingHandler(ctx, out_func=None)[source]¶
Bases:
CloudifyBaseLoggingHandler
A handler class for writing plugin log messages to RabbitMQ
- class cloudify.logs.CloudifyWorkflowLoggingHandler(ctx, out_func=None)[source]¶
Bases:
CloudifyBaseLoggingHandler
A Handler class for writing workflow log messages to RabbitMQ
- class cloudify.logs.CloudifyWorkflowNodeLoggingHandler(ctx, out_func=None)[source]¶
Bases:
CloudifyBaseLoggingHandler
A Handler class for writing workflow nodes log messages to RabbitMQ
- class cloudify.logs.CloudifyCtxLoggingHandler(ctx)[source]¶
Bases:
Handler
A logging handler for Cloudify’s context logger. A logger attached to this handler will result in logging being passed through to the Cloudify logger. This is useful for plugins that would like to have underlying APIs’ loggers flow through to the Cloudify context logger.
- cloudify.logs.init_cloudify_logger(handler, logger_name, logging_level=10)[source]¶
Instantiate an amqp backed logger based on the provided handler for sending log messages
- Parameters:
handler – A logger handler based on the context
logger_name – The logger name
logging_level – The logging level
- Returns:
An amqp backed logger
- cloudify.logs.send_workflow_event(ctx, event_type, message=None, args=None, additional_context=None, out_func=None)[source]¶
Send a workflow event
- Parameters:
ctx – A CloudifyWorkflowContext instance
event_type – The event type
message – The message
args – additional arguments that may be added to the message
additional_context – additional context to be added to the context
- cloudify.logs.send_workflow_node_event(ctx, event_type, message=None, args=None, additional_context=None, out_func=None, skip_send=False)[source]¶
Send a workflow node event
- Parameters:
ctx – A CloudifyWorkflowNode instance
event_type – The event type
message – The message
args – additional arguments that may be added to the message
additional_context – additional context to be added to the context
skip_send – Only for internal use - do not send the event to the manager, but log it to the logfile
- cloudify.logs.send_plugin_event(ctx, message=None, args=None, additional_context=None, out_func=None)[source]¶
Send a plugin event to RabbitMQ
- Parameters:
ctx – A CloudifyContext instance
message – The message
args – additional arguments that may be added to the message
additional_context – additional context to be added to the context
- cloudify.logs.send_task_event(cloudify_context, event_type, message=None, args=None, additional_context=None, out_func=None)[source]¶
Send a task event
- Parameters:
cloudify_context – a __cloudify_context struct as passed to operations
event_type – The event type
message – The message
args – additional arguments that may be added to the message
additional_context – additional context to be added to the context
- cloudify.logs.setup_agent_logger(log_name, log_level=None, log_dir=None, max_bytes=None, max_history=None)[source]¶
- class cloudify.logs.ExecutorNameFormatter(fmt=None, datefmt=None, style='%', validate=True, *, defaults=None)[source]¶
Bases:
Formatter
- default_fmt = <logging.Formatter object>¶
- user_fmt = <logging.Formatter object>¶
- format(record)[source]¶
Format the specified record as text.
The record’s attribute dictionary is used as the operand to a string formatting operation which yields the returned string. Before formatting the dictionary, a couple of preparatory steps are carried out. The message attribute of the record is computed using LogRecord.getMessage(). If the formatting string uses the time (as determined by a call to usesTime(), formatTime() is called to format the event time. If there is exception information, it is formatted using formatException() and appended to the message.