[英]What does the name of the resource block represent in chef's log construct?
我对主厨文档中 'name'元素的描述感到困惑。 示例代码:
log 'message' do
message 'This is the message that will be added to the log.'
level :info
end
为什么消息在上面出现两次?
每次发生时意味着什么?
我认为该文档只是选择了资源块的名称有点不明智。 一个更好的例子可能是:
log 'foo' do
message 'Logging to foo'
level :fatal
end
在这种情况下,日志资源的名称为'foo'
,而message
参数指示要记录的消息。 如果message
参数为空,则默认为name
的值(在本例中为'foo'
)。 所以,在这种情况下:
log 'foo' do
level :fatal
end
文字文本foo
将被转储到您的日志文件中。
该名称是message
属性的默认值。 如果明确指定message
则该名称仅用于通知路由和重复数据删除。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.