當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript core.ILogger類代碼示例

本文整理匯總了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;
}
開發者ID:denwilliams,項目名稱:homenet-plugin-ninjablock,代碼行數:25,代碼來源:client.ts

示例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;
  });
開發者ID:denwilliams,項目名稱:homenet-plugin-hue,代碼行數:12,代碼來源:hue-controller.ts

示例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}`)
   }
 }
開發者ID:denwilliams,項目名稱:homenet-plugin-zway,代碼行數:16,代碼來源:factories.ts

示例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);
 }
開發者ID:denwilliams,項目名稱:homenet-plugin-zway,代碼行數:5,代碼來源:factories.ts

示例5: setLightState

 setLightState(hubId: string, lightId: string, value: any) : void {
   this.logger.info('Setting light for ' + hubId + lightId);
   this.getHub(hubId).setLightState(lightId, value);
 }
開發者ID:denwilliams,項目名稱:homenet-plugin-hue,代碼行數:4,代碼來源:hue-controller.ts

示例6: setGroupLightState

 setGroupLightState(hubId: string, groupId: string, value: any) : void {
   this.logger.info('Setting light for ' + hubId + groupId);
   this.getHub(hubId).setGroupLightState(groupId, value);
 }
開發者ID:denwilliams,項目名稱:homenet-plugin-hue,代碼行數:4,代碼來源:hue-controller.ts

示例7: function

 socket.on('disconnect', function() {
   logger.info('Ninjabridge disconnected');
 });
開發者ID:denwilliams,項目名稱:homenet-plugin-ninjablock,代碼行數:3,代碼來源:client.ts


注:本文中的@homenet/core.ILogger類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。