当前位置: 首页>>代码示例>>Java>>正文


Java Loggers类代码示例

本文整理汇总了Java中org.altbeacon.beacon.logging.Loggers的典型用法代码示例。如果您正苦于以下问题:Java Loggers类的具体用法?Java Loggers怎么用?Java Loggers使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Loggers类属于org.altbeacon.beacon.logging包,在下文中一共展示了Loggers类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testDetectsGattBeacon

import org.altbeacon.beacon.logging.Loggers; //导入依赖的package包/类
@Test
public void testDetectsGattBeacon() {
    org.robolectric.shadows.ShadowLog.stream = System.err;
    LogManager.setLogger(Loggers.verboseLogger());
    LogManager.setVerboseLoggingEnabled(true);
    System.err.println("verbose logging:"+LogManager.isVerboseLoggingEnabled());
    byte[] bytes = hexStringToByteArray("020106030334121516341200e72f234454f4911ba9ffa6000000000001000000000000000000000000000000000000000000000000000000000000000000");
    BeaconParser parser = new BeaconParser().setBeaconLayout("s:0-1=1234,m:2-2=00,p:3-3:-41,i:4-13,i:14-19");
    assertNotNull("Service uuid parsed should not be null", parser.getServiceUuid());
    Beacon gattBeacon = parser.fromScanData(bytes, -55, null);
    assertNotNull("GattBeacon should be not null if parsed successfully", gattBeacon);
    assertEquals("id1 should be parsed", "0x2f234454f4911ba9ffa6", gattBeacon.getId1().toString());
    assertEquals("id2 should be parsed", "0x000000000001", gattBeacon.getId2().toString());
    assertEquals("serviceUuid should be parsed", 0x1234, gattBeacon.getServiceUuid());
    assertEquals("txPower should be parsed", -66, gattBeacon.getTxPower());
}
 
开发者ID:AltBeacon,项目名称:android-beacon-library,代码行数:17,代码来源:GattBeaconTest.java

示例2: testDetectsGattBeacon2WithShortIdentifier

import org.altbeacon.beacon.logging.Loggers; //导入依赖的package包/类
@Test
public void testDetectsGattBeacon2WithShortIdentifier() {
    org.robolectric.shadows.ShadowLog.stream = System.err;
    LogManager.setLogger(Loggers.verboseLogger());
    LogManager.setVerboseLoggingEnabled(true);
    LogManager.d("GattBeaconTest", "Parsing short packet");
    byte[] bytes = hexStringToByteArray("020106030334121516341210ec007261646975736e6574776f726b7307000000000000000000000000000000000000000000000000000000000000000000");
    BeaconParser parser = new BeaconParser().setBeaconLayout("s:0-1=1234,m:2-2=10,p:3-3:-41,i:4-20v");
    Beacon gattBeacon = parser.fromScanData(bytes, -55, null);
    assertNotNull("GattBeacon should be not null if parsed successfully", gattBeacon);
    assertEquals("GattBeacon identifier length should be adjusted smaller if packet is short",
                 16,
                 gattBeacon.getId1().toByteArray().length);
    assertEquals("GattBeacon identifier should have proper first byte",
            (byte)0x00,
            gattBeacon.getId1().toByteArray()[0]);
    assertEquals("GattBeacon identifier should have proper second to last byte",
            (byte) 0x73,
            gattBeacon.getId1().toByteArray()[14]);
    assertEquals("GattBeacon identifier should have proper last byte",
            (byte)0x07,
            gattBeacon.getId1().toByteArray()[15]);

}
 
开发者ID:AltBeacon,项目名称:android-beacon-library,代码行数:25,代码来源:GattBeaconTest.java

示例3: testDetectsUriBeacon

import org.altbeacon.beacon.logging.Loggers; //导入依赖的package包/类
@Test
public void testDetectsUriBeacon() {
    org.robolectric.shadows.ShadowLog.stream = System.err;
    LogManager.setLogger(Loggers.verboseLogger());
    LogManager.setVerboseLoggingEnabled(true);
    //"https://goo.gl/hqBXE1"
    byte[] bytes = {2, 1, 4, 3, 3, (byte) 216, (byte) 254, 19, 22, (byte) 216, (byte) 254, 0, (byte) 242, 3, 103, 111, 111, 46, 103, 108, 47, 104, 113, 66, 88, 69, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
    BeaconParser parser = new BeaconParser().setBeaconLayout("s:0-1=fed8,m:2-2=00,p:3-3:-41,i:4-21v");
    LogManager.d("xxx", "------");
    Beacon uriBeacon = parser.fromScanData(bytes, -55, null);
    assertNotNull("UriBeacon should be not null if parsed successfully", uriBeacon);
    assertEquals("UriBeacon identifier length should be correct",
            14,
            uriBeacon.getId1().toByteArray().length);
    String urlString = UrlBeaconUrlCompressor.uncompress(uriBeacon.getId1().toByteArray());
    assertEquals("URL should be decompressed successfully", "https://goo.gl/hqBXE1", urlString);
}
 
开发者ID:AltBeacon,项目名称:android-beacon-library,代码行数:18,代码来源:GattBeaconTest.java

示例4: testParsesBeaconMissingDataField

import org.altbeacon.beacon.logging.Loggers; //导入依赖的package包/类
@Test
public void testParsesBeaconMissingDataField() {
    LogManager.setLogger(Loggers.verboseLogger());
    org.robolectric.shadows.ShadowLog.stream = System.err;
    byte[] bytes = hexStringToByteArray("02011a1aff1801beac2f234454cf6d4a0fadf2f4911ba9ffa600010002c5000000");
    BeaconParser parser = new BeaconParser();
    parser.setBeaconLayout("m:2-3=beac,i:4-19,i:20-21,i:22-23,p:24-24,d:25-25");
    Beacon beacon = parser.fromScanData(bytes, -55, null);
    assertEquals("mRssi should be as passed in", -55, beacon.getRssi());
    assertEquals("uuid should be parsed", "2f234454-cf6d-4a0f-adf2-f4911ba9ffa6", beacon.getIdentifier(0).toString());
    assertEquals("id2 should be parsed", "1", beacon.getIdentifier(1).toString());
    assertEquals("id3 should be parsed", "2", beacon.getIdentifier(2).toString());
    assertEquals("txPower should be parsed", -59, beacon.getTxPower());
    assertEquals("manufacturer should be parsed", 0x118 ,beacon.getManufacturer());
    assertEquals("missing data field zero should be zero", new Long(0l), beacon.getDataFields().get(0));

}
 
开发者ID:AltBeacon,项目名称:android-beacon-library,代码行数:18,代码来源:BeaconParserTest.java

示例5: setBeaconsLogLevel

import org.altbeacon.beacon.logging.Loggers; //导入依赖的package包/类
private void setBeaconsLogLevel(OrchextraLogger orchextraLogger) {
  if (orchextraLogger.getOrchextraSDKLogLevel() == OrchextraSDKLogLevel.ALL){
    LogManager.setVerboseLoggingEnabled(true);
    LogManager.setLogger(Loggers.verboseLogger());
  }else{
    LogManager.setVerboseLoggingEnabled(false);
    LogManager.setLogger(Loggers.empty());
  }
}
 
开发者ID:Orchextra,项目名称:orchextra-android-sdk,代码行数:10,代码来源:BeaconsModule.java

示例6: setDebug

import org.altbeacon.beacon.logging.Loggers; //导入依赖的package包/类
/**
 * Set to true if you want to show library debugging.
 *
 * @param debug True turn on all logs for this library to be printed out to logcat. False turns
 *              off all logging.
 * @deprecated To be removed in a future release. Use
 * {@link org.altbeacon.beacon.logging.LogManager#setLogger(org.altbeacon.beacon.logging.Logger)}
 * instead.
 */
@Deprecated
public static void setDebug(boolean debug) {
    if (debug) {
        LogManager.setLogger(Loggers.verboseLogger());
        LogManager.setVerboseLoggingEnabled(true);
    } else {
        LogManager.setLogger(Loggers.empty());
        LogManager.setVerboseLoggingEnabled(false);
    }
}
 
开发者ID:AltBeacon,项目名称:android-beacon-library,代码行数:20,代码来源:BeaconManager.java

示例7: before

import org.altbeacon.beacon.logging.Loggers; //导入依赖的package包/类
@Before
public void before() {
    org.robolectric.shadows.ShadowLog.stream = System.err;
    LogManager.setLogger(Loggers.verboseLogger());
    LogManager.setVerboseLoggingEnabled(true);
    BeaconManager.setsManifestCheckingDisabled(true);
}
 
开发者ID:AltBeacon,项目名称:android-beacon-library,代码行数:8,代码来源:MonitoringStatusTest.java

示例8: testDetectsGattBeacon2MaxLength

import org.altbeacon.beacon.logging.Loggers; //导入依赖的package包/类
@Test
public void testDetectsGattBeacon2MaxLength() {
    org.robolectric.shadows.ShadowLog.stream = System.err;
    LogManager.setLogger(Loggers.verboseLogger());
    LogManager.setVerboseLoggingEnabled(true);
    byte[] bytes = hexStringToByteArray("020106030334121616341210ec007261646975736e6574776f726b7373070000000000000000000000000000000000000000000000000000000000000000");
    BeaconParser parser = new BeaconParser().setBeaconLayout("s:0-1=1234,m:2-2=10,p:3-3:-41,i:4-20v");
    Beacon gattBeacon = parser.fromScanData(bytes, -55, null);
    assertNotNull("GattBeacon should be not null if parsed successfully", gattBeacon);
    assertEquals("GattBeacon identifier length should be proper length",
            17,
            gattBeacon.getId1().toByteArray().length);

}
 
开发者ID:AltBeacon,项目名称:android-beacon-library,代码行数:15,代码来源:GattBeaconTest.java

示例9: testDetectsEddystoneUID

import org.altbeacon.beacon.logging.Loggers; //导入依赖的package包/类
@Test
public void testDetectsEddystoneUID() {
    org.robolectric.shadows.ShadowLog.stream = System.err;
    LogManager.setLogger(Loggers.verboseLogger());
    LogManager.setVerboseLoggingEnabled(true);
    byte[] bytes = hexStringToByteArray("0201060303aafe1516aafe00e700010203040506070809010203040506000000000000000000000000000000000000000000000000000000000000000000");
    BeaconParser parser = new BeaconParser().setBeaconLayout(BeaconParser.EDDYSTONE_UID_LAYOUT);
    Beacon eddystoneUidBeacon = parser.fromScanData(bytes, -55, null);
    assertNotNull("Eddystone-UID should be not null if parsed successfully", eddystoneUidBeacon);
}
 
开发者ID:AltBeacon,项目名称:android-beacon-library,代码行数:11,代码来源:GattBeaconTest.java

示例10: testDetectsGattBeaconWithCnn

import org.altbeacon.beacon.logging.Loggers; //导入依赖的package包/类
@Test
public void testDetectsGattBeaconWithCnn() {
    org.robolectric.shadows.ShadowLog.stream = System.err;
    LogManager.setLogger(Loggers.verboseLogger());
    LogManager.setVerboseLoggingEnabled(true);
    LogManager.d("GattBeaconTest", "Parsing short packet");
    byte[] bytes = hexStringToByteArray("020106030334120a16341210ed00636e6e070000000000000000000000000000000000000000000000000000000000000000000000000000000000000000");
    BeaconParser parser = new BeaconParser().setBeaconLayout("s:0-1=1234,m:2-2=10,p:3-3:-41,i:4-20v");
    LogManager.d("xxx", "------");
    Beacon gattBeacon = parser.fromScanData(bytes, -55, null);
    assertNotNull("GattBeacon should be not null if parsed successfully", gattBeacon);
    assertEquals("GattBeacon identifier length should be adjusted smaller if packet is short",
            5,
            gattBeacon.getId1().toByteArray().length);
}
 
开发者ID:AltBeacon,项目名称:android-beacon-library,代码行数:16,代码来源:GattBeaconTest.java

示例11: testRecognizeBeacon

import org.altbeacon.beacon.logging.Loggers; //导入依赖的package包/类
@Test
public void testRecognizeBeacon() {
    LogManager.setLogger(Loggers.verboseLogger());
    org.robolectric.shadows.ShadowLog.stream = System.err;
    byte[] bytes = hexStringToByteArray("02011a1aff180112342f234454cf6d4a0fadf2f4911ba9ffa600010002c5");
    BeaconParser parser = new BeaconParser();
    parser.setBeaconLayout("m:2-3=1234,i:4-19,i:20-21,i:22-23,p:24-24,d:25-25");
    Beacon beacon = parser.fromScanData(bytes, -55, null);
    assertEquals("mRssi should be as passed in", -55, beacon.getRssi());
    assertEquals("uuid should be parsed", "2f234454-cf6d-4a0f-adf2-f4911ba9ffa6", beacon.getIdentifier(0).toString());
    assertEquals("id2 should be parsed", "1", beacon.getIdentifier(1).toString());
    assertEquals("id3 should be parsed", "2", beacon.getIdentifier(2).toString());
    assertEquals("txPower should be parsed", -59, beacon.getTxPower());
    assertEquals("manufacturer should be parsed", 0x118 ,beacon.getManufacturer());
}
 
开发者ID:AltBeacon,项目名称:android-beacon-library,代码行数:16,代码来源:BeaconParserTest.java

示例12: testAllowsAccessToParserIdentifier

import org.altbeacon.beacon.logging.Loggers; //导入依赖的package包/类
@Test
public void testAllowsAccessToParserIdentifier() {
    LogManager.setLogger(Loggers.verboseLogger());
    org.robolectric.shadows.ShadowLog.stream = System.err;
    byte[] bytes = hexStringToByteArray("02011a1aff180112342f234454cf6d4a0fadf2f4911ba9ffa600010002c5");
    BeaconParser parser = new BeaconParser("my_beacon_type");
    parser.setBeaconLayout("m:2-3=1234,i:4-19,i:20-21,i:22-23,p:24-24,d:25-25");
    Beacon beacon = parser.fromScanData(bytes, -55, null);
    assertEquals("parser identifier should be accessible", "my_beacon_type", beacon.getParserIdentifier());
}
 
开发者ID:AltBeacon,项目名称:android-beacon-library,代码行数:11,代码来源:BeaconParserTest.java

示例13: testRecognizeBeaconWithFormatSpecifyingManufacturer

import org.altbeacon.beacon.logging.Loggers; //导入依赖的package包/类
@Test
public void testRecognizeBeaconWithFormatSpecifyingManufacturer() {
    LogManager.setLogger(Loggers.verboseLogger());
    org.robolectric.shadows.ShadowLog.stream = System.err;
    byte[] bytes = hexStringToByteArray("02011a1bff1801beac2f234454cf6d4a0fadf2f4911ba9ffa600010002c509000000");
    BeaconParser parser = new BeaconParser();
    parser.setBeaconLayout("m:0-3=1801beac,i:4-19,i:20-21,i:22-23,p:24-24,d:25-25");
    Beacon beacon = parser.fromScanData(bytes, -55, null);
    assertEquals("mRssi should be as passed in", -55, beacon.getRssi());
    assertEquals("uuid should be parsed", "2f234454-cf6d-4a0f-adf2-f4911ba9ffa6", beacon.getIdentifier(0).toString());
    assertEquals("id2 should be parsed", "1", beacon.getIdentifier(1).toString());
    assertEquals("id3 should be parsed", "2", beacon.getIdentifier(2).toString());
    assertEquals("txPower should be parsed", -59, beacon.getTxPower());
    assertEquals("manufacturer should be parsed", 0x118 ,beacon.getManufacturer());
}
 
开发者ID:AltBeacon,项目名称:android-beacon-library,代码行数:16,代码来源:BeaconParserTest.java


注:本文中的org.altbeacon.beacon.logging.Loggers类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。