+# SPDX-License-Identifier: MulanPSL-2.0+ +# Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved. +# frozen_string_literal: true
+require 'logger'
+# define a logger format +class Mylog < Logger
- def initialize(filename)
- @name = filename
what does this @name for, it seems no anywhere else use it.
Thanks, Luan Shengde
- if FileTest.exist?(filename)
File.delete(filename)
- end
- super(filename)
- self.datetime_format = '%Y-%m-%d %H:%M:%s'
- self.formatter = proc do |severity, datetime, _, msg|
"#{datetime}-#{severity}: #{msg}\n"
- end
- end
+end
2.23.0