本文整理匯總了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');
});