我可以使用VC2
来使用VC1
依赖性。
class VC1 : UIViewController {
var isShowListAsked: Bool = false
func onTapMapButton(_ sender: UIButton) {
if let controller = self.storyboard?.instantiateViewController(withIdentifier: "VC2") as? VC2 {
controller.handler = {[weak self] (value) in
self?.isShowListAsked = value
print(self?.isShowListAsked)
}
self.present(controller, animated: true, completion: nil)
}
}
}
但是当我尝试像下面这样导入时,它不起作用。如何解决?
winston-daily-rotate-file
require
在运行应用程序时,出现以下错误
var DailyRotateFile = require('winston-daily-rotate-file');
答案 0 :(得分:1)
import * as winston from 'winston';
import 'winston-daily-rotate-file';
import appRoot from 'app-root-path';
const logger = winston.createLogger({
transports: [
new winston.transports.DailyRotateFile ({
filename: 'application-%DATE%.log',
dirname: `${appRoot}/logs/`,
level: 'info',
handleExceptions: true,
colorize: true,
json: false,
zippedArchive: true,
maxSize: '20m',
maxFiles: '14d'
})
],
exitOnError: false
});
logger.stream = {
write: function(message, encoding) {
logger.info(message);
},
};
export default logger;
这会将记录器配置为每日轮换。
答案 1 :(得分:0)
尝试
import DailyRotateFile = require("winston-daily-rotate-file");
答案 2 :(得分:0)
尝试一下:
DateTime.Now