本文整理汇总了TypeScript中@homenet/core.ILogger类的典型用法代码示例。如果您正苦于以下问题:TypeScript ILogger类的具体用法?TypeScript ILogger怎么用?TypeScript ILogger使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ILogger类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: connect
export function connect(url: string, logger: ILogger, sensorCallback: ISensorCallback) {
logger.info('Connecting to bridge ' + url);
var socket = socketIo(url);
socket.on('connect', function() {
logger.info('Ninjabridge connected');
});
socket.on('disconnect', function() {
logger.info('Ninjabridge disconnected');
});
// socket.on('0_0_11.rfsensor', function(data){
// logger.debug('Got RF sensor data ' + JSON.stringify(data));
// sensorCallback(data);
// });
socket.on('event', function(data) {
sensorCallback(data);
// console.log('event', data);
});
return socket;
}
示例2: createHub
hubs.forEach(function(hub: IHubConfig) {
const id = hub.id;
const name = hub.name;
const host = hub.host;
const key = hub.key;
logger.info('Setting up Hue hub ' + name + ' (' + id + ') on ' + host);
const hubApi: IHueApi = createHub(host, key);
// debugPrintHub(hub, hubApi);
res[id] = hubApi;
});
示例3: sensorFactory
return function sensorFactory(id : string, opts : any) : ISensor {
logger.info(`Adding Z-Way ${type} sensor: ${id}`);
const controller : ZwayController = controllers[opts.controller];
switch (type) {
case 'motion':
return new ZwayMotionSensor(id, controller, opts);
case 'temperature':
return new ZwayTemperatureSensor(id, controller, opts);
case 'humidity':
return new ZwayHumiditySensor(id, controller, opts);
case 'luminescence':
return new ZwayLuminescenceSensor(id, controller, opts);
default:
throw new Error(`Could not create ${type} sensor: ${id}`)
}
}
示例4: lockFactory
return function lockFactory(id : string, opts : any) : ISettable {
logger.info('Adding Z-Way lock: ' + id);
const controller : ZwayController = controllers[opts.controller];
return new ZwayLock(id, controller, opts.deviceId);
}
示例5: setLightState
setLightState(hubId: string, lightId: string, value: any) : void {
this.logger.info('Setting light for ' + hubId + lightId);
this.getHub(hubId).setLightState(lightId, value);
}
示例6: setGroupLightState
setGroupLightState(hubId: string, groupId: string, value: any) : void {
this.logger.info('Setting light for ' + hubId + groupId);
this.getHub(hubId).setGroupLightState(groupId, value);
}
示例7: function
socket.on('disconnect', function() {
logger.info('Ninjabridge disconnected');
});