2020-12-26 14:12:05 -08:00
|
|
|
// Copyright (c) FIRST and other WPILib contributors.
|
|
|
|
|
// Open Source Software; you can modify and/or share it under the terms of
|
|
|
|
|
// the WPILib BSD license file in the root directory of this project.
|
Implement independent instances.
Previously, most of the classes were implemented as singletons so only one
instance was possible.
This change adds an instance handle-based API. In Java, this API is located
in a different package than the old API (edu.wpi.first.networktables).
Backwards compatibility with ITable and the old NetworkTable API is largely
maintained, but a handful of classes have moved to the new package in Java
(ConnectionInfo and PersistentException), and the old JNI has been completed
replaced.
Also:
- Move SetTeam implementation to Dispatcher.
- Consistently pass time through Java and C++ Value API.
- Rename nt_Value.h to NetworkTableValue.h for consistency with Java.
- Improve documentation
- Make C++ and Java APIs more consistent
- Document RPC functions and support RPC in Java.
- Add polling features for entry and connection listeners and use them to
move callback threads to Java level.
- Remove thread start and stop hooks (as polling is available).
- Make Notifiers, RpcServer, Dispatcher, and Storage mockable.
- Set NOTIFY_NEW on immediate entry notifications.
- Make GetTable("/") and GetTable("") equivalent.
- Generate local notification for flags update when loading persistent file.
And many unit test updates/changes:
- Use InitGoogleMock instead of InitGoogleTest in test main.
- Move test printers to TestPrinter.h/cpp.
- Provide printers for StringRef, EntryNotifier, and Handle.
- StorageTest: Check notifications.
- Add entry notifier unit tests.
- Storage: Add test for incoming entry assignment.
- Update connection listener tests.
- Add entry listener unit tests.
Fixes #11, #140, #189, #190, #192, #193, #221
2017-04-23 10:26:17 -07:00
|
|
|
|
|
|
|
|
#include "LoggerImpl.h"
|
|
|
|
|
|
2021-06-06 16:13:58 -07:00
|
|
|
#include <fmt/format.h>
|
2022-10-31 21:52:14 -07:00
|
|
|
#include <wpi/Logger.h>
|
|
|
|
|
#include <wpi/SmallVector.h>
|
2021-06-01 21:50:35 -07:00
|
|
|
#include <wpi/fs.h>
|
Implement independent instances.
Previously, most of the classes were implemented as singletons so only one
instance was possible.
This change adds an instance handle-based API. In Java, this API is located
in a different package than the old API (edu.wpi.first.networktables).
Backwards compatibility with ITable and the old NetworkTable API is largely
maintained, but a handful of classes have moved to the new package in Java
(ConnectionInfo and PersistentException), and the old JNI has been completed
replaced.
Also:
- Move SetTeam implementation to Dispatcher.
- Consistently pass time through Java and C++ Value API.
- Rename nt_Value.h to NetworkTableValue.h for consistency with Java.
- Improve documentation
- Make C++ and Java APIs more consistent
- Document RPC functions and support RPC in Java.
- Add polling features for entry and connection listeners and use them to
move callback threads to Java level.
- Remove thread start and stop hooks (as polling is available).
- Make Notifiers, RpcServer, Dispatcher, and Storage mockable.
- Set NOTIFY_NEW on immediate entry notifications.
- Make GetTable("/") and GetTable("") equivalent.
- Generate local notification for flags update when loading persistent file.
And many unit test updates/changes:
- Use InitGoogleMock instead of InitGoogleTest in test main.
- Move test printers to TestPrinter.h/cpp.
- Provide printers for StringRef, EntryNotifier, and Handle.
- StorageTest: Check notifications.
- Add entry notifier unit tests.
- Storage: Add test for incoming entry assignment.
- Update connection listener tests.
- Add entry listener unit tests.
Fixes #11, #140, #189, #190, #192, #193, #221
2017-04-23 10:26:17 -07:00
|
|
|
|
2022-10-31 21:52:14 -07:00
|
|
|
#include "IListenerStorage.h"
|
|
|
|
|
|
Implement independent instances.
Previously, most of the classes were implemented as singletons so only one
instance was possible.
This change adds an instance handle-based API. In Java, this API is located
in a different package than the old API (edu.wpi.first.networktables).
Backwards compatibility with ITable and the old NetworkTable API is largely
maintained, but a handful of classes have moved to the new package in Java
(ConnectionInfo and PersistentException), and the old JNI has been completed
replaced.
Also:
- Move SetTeam implementation to Dispatcher.
- Consistently pass time through Java and C++ Value API.
- Rename nt_Value.h to NetworkTableValue.h for consistency with Java.
- Improve documentation
- Make C++ and Java APIs more consistent
- Document RPC functions and support RPC in Java.
- Add polling features for entry and connection listeners and use them to
move callback threads to Java level.
- Remove thread start and stop hooks (as polling is available).
- Make Notifiers, RpcServer, Dispatcher, and Storage mockable.
- Set NOTIFY_NEW on immediate entry notifications.
- Make GetTable("/") and GetTable("") equivalent.
- Generate local notification for flags update when loading persistent file.
And many unit test updates/changes:
- Use InitGoogleMock instead of InitGoogleTest in test main.
- Move test printers to TestPrinter.h/cpp.
- Provide printers for StringRef, EntryNotifier, and Handle.
- StorageTest: Check notifications.
- Add entry notifier unit tests.
- Storage: Add test for incoming entry assignment.
- Update connection listener tests.
- Add entry listener unit tests.
Fixes #11, #140, #189, #190, #192, #193, #221
2017-04-23 10:26:17 -07:00
|
|
|
using namespace nt;
|
|
|
|
|
|
|
|
|
|
static void DefaultLogger(unsigned int level, const char* file,
|
|
|
|
|
unsigned int line, const char* msg) {
|
2022-10-31 21:52:14 -07:00
|
|
|
if (level == wpi::WPI_LOG_INFO) {
|
2021-06-06 16:13:58 -07:00
|
|
|
fmt::print(stderr, "NT: {}\n", msg);
|
Implement independent instances.
Previously, most of the classes were implemented as singletons so only one
instance was possible.
This change adds an instance handle-based API. In Java, this API is located
in a different package than the old API (edu.wpi.first.networktables).
Backwards compatibility with ITable and the old NetworkTable API is largely
maintained, but a handful of classes have moved to the new package in Java
(ConnectionInfo and PersistentException), and the old JNI has been completed
replaced.
Also:
- Move SetTeam implementation to Dispatcher.
- Consistently pass time through Java and C++ Value API.
- Rename nt_Value.h to NetworkTableValue.h for consistency with Java.
- Improve documentation
- Make C++ and Java APIs more consistent
- Document RPC functions and support RPC in Java.
- Add polling features for entry and connection listeners and use them to
move callback threads to Java level.
- Remove thread start and stop hooks (as polling is available).
- Make Notifiers, RpcServer, Dispatcher, and Storage mockable.
- Set NOTIFY_NEW on immediate entry notifications.
- Make GetTable("/") and GetTable("") equivalent.
- Generate local notification for flags update when loading persistent file.
And many unit test updates/changes:
- Use InitGoogleMock instead of InitGoogleTest in test main.
- Move test printers to TestPrinter.h/cpp.
- Provide printers for StringRef, EntryNotifier, and Handle.
- StorageTest: Check notifications.
- Add entry notifier unit tests.
- Storage: Add test for incoming entry assignment.
- Update connection listener tests.
- Add entry listener unit tests.
Fixes #11, #140, #189, #190, #192, #193, #221
2017-04-23 10:26:17 -07:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2021-06-06 16:13:58 -07:00
|
|
|
std::string_view levelmsg;
|
2022-10-31 21:52:14 -07:00
|
|
|
if (level >= wpi::WPI_LOG_CRITICAL) {
|
2021-06-06 16:13:58 -07:00
|
|
|
levelmsg = "CRITICAL";
|
2022-10-31 21:52:14 -07:00
|
|
|
} else if (level >= wpi::WPI_LOG_ERROR) {
|
2021-06-06 16:13:58 -07:00
|
|
|
levelmsg = "ERROR";
|
2022-10-31 21:52:14 -07:00
|
|
|
} else if (level >= wpi::WPI_LOG_WARNING) {
|
2021-06-06 16:13:58 -07:00
|
|
|
levelmsg = "WARNING";
|
2020-12-28 12:58:06 -08:00
|
|
|
} else {
|
Implement independent instances.
Previously, most of the classes were implemented as singletons so only one
instance was possible.
This change adds an instance handle-based API. In Java, this API is located
in a different package than the old API (edu.wpi.first.networktables).
Backwards compatibility with ITable and the old NetworkTable API is largely
maintained, but a handful of classes have moved to the new package in Java
(ConnectionInfo and PersistentException), and the old JNI has been completed
replaced.
Also:
- Move SetTeam implementation to Dispatcher.
- Consistently pass time through Java and C++ Value API.
- Rename nt_Value.h to NetworkTableValue.h for consistency with Java.
- Improve documentation
- Make C++ and Java APIs more consistent
- Document RPC functions and support RPC in Java.
- Add polling features for entry and connection listeners and use them to
move callback threads to Java level.
- Remove thread start and stop hooks (as polling is available).
- Make Notifiers, RpcServer, Dispatcher, and Storage mockable.
- Set NOTIFY_NEW on immediate entry notifications.
- Make GetTable("/") and GetTable("") equivalent.
- Generate local notification for flags update when loading persistent file.
And many unit test updates/changes:
- Use InitGoogleMock instead of InitGoogleTest in test main.
- Move test printers to TestPrinter.h/cpp.
- Provide printers for StringRef, EntryNotifier, and Handle.
- StorageTest: Check notifications.
- Add entry notifier unit tests.
- Storage: Add test for incoming entry assignment.
- Update connection listener tests.
- Add entry listener unit tests.
Fixes #11, #140, #189, #190, #192, #193, #221
2017-04-23 10:26:17 -07:00
|
|
|
return;
|
2020-12-28 12:58:06 -08:00
|
|
|
}
|
2021-06-06 16:13:58 -07:00
|
|
|
fmt::print(stderr, "NT: {}: {} ({}:{})\n", levelmsg, msg, file, line);
|
Implement independent instances.
Previously, most of the classes were implemented as singletons so only one
instance was possible.
This change adds an instance handle-based API. In Java, this API is located
in a different package than the old API (edu.wpi.first.networktables).
Backwards compatibility with ITable and the old NetworkTable API is largely
maintained, but a handful of classes have moved to the new package in Java
(ConnectionInfo and PersistentException), and the old JNI has been completed
replaced.
Also:
- Move SetTeam implementation to Dispatcher.
- Consistently pass time through Java and C++ Value API.
- Rename nt_Value.h to NetworkTableValue.h for consistency with Java.
- Improve documentation
- Make C++ and Java APIs more consistent
- Document RPC functions and support RPC in Java.
- Add polling features for entry and connection listeners and use them to
move callback threads to Java level.
- Remove thread start and stop hooks (as polling is available).
- Make Notifiers, RpcServer, Dispatcher, and Storage mockable.
- Set NOTIFY_NEW on immediate entry notifications.
- Make GetTable("/") and GetTable("") equivalent.
- Generate local notification for flags update when loading persistent file.
And many unit test updates/changes:
- Use InitGoogleMock instead of InitGoogleTest in test main.
- Move test printers to TestPrinter.h/cpp.
- Provide printers for StringRef, EntryNotifier, and Handle.
- StorageTest: Check notifications.
- Add entry notifier unit tests.
- Storage: Add test for incoming entry assignment.
- Update connection listener tests.
- Add entry listener unit tests.
Fixes #11, #140, #189, #190, #192, #193, #221
2017-04-23 10:26:17 -07:00
|
|
|
}
|
|
|
|
|
|
2022-10-31 21:52:14 -07:00
|
|
|
static constexpr unsigned int kFlagCritical = 1u << 16;
|
|
|
|
|
static constexpr unsigned int kFlagError = 1u << 17;
|
|
|
|
|
static constexpr unsigned int kFlagWarning = 1u << 18;
|
|
|
|
|
static constexpr unsigned int kFlagInfo = 1u << 19;
|
|
|
|
|
static constexpr unsigned int kFlagDebug = 1u << 20;
|
|
|
|
|
static constexpr unsigned int kFlagDebug1 = 1u << 21;
|
|
|
|
|
static constexpr unsigned int kFlagDebug2 = 1u << 22;
|
|
|
|
|
static constexpr unsigned int kFlagDebug3 = 1u << 23;
|
|
|
|
|
static constexpr unsigned int kFlagDebug4 = 1u << 24;
|
|
|
|
|
|
|
|
|
|
static unsigned int LevelToFlag(unsigned int level) {
|
|
|
|
|
if (level >= wpi::WPI_LOG_CRITICAL) {
|
|
|
|
|
return EventFlags::kLogMessage | kFlagCritical;
|
|
|
|
|
} else if (level >= wpi::WPI_LOG_ERROR) {
|
|
|
|
|
return EventFlags::kLogMessage | kFlagError;
|
|
|
|
|
} else if (level >= wpi::WPI_LOG_WARNING) {
|
|
|
|
|
return EventFlags::kLogMessage | kFlagWarning;
|
|
|
|
|
} else if (level >= wpi::WPI_LOG_INFO) {
|
|
|
|
|
return EventFlags::kLogMessage | kFlagInfo;
|
|
|
|
|
} else if (level >= wpi::WPI_LOG_DEBUG) {
|
|
|
|
|
return EventFlags::kLogMessage | kFlagDebug;
|
|
|
|
|
} else if (level >= wpi::WPI_LOG_DEBUG1) {
|
|
|
|
|
return EventFlags::kLogMessage | kFlagDebug1;
|
|
|
|
|
} else if (level >= wpi::WPI_LOG_DEBUG2) {
|
|
|
|
|
return EventFlags::kLogMessage | kFlagDebug2;
|
|
|
|
|
} else if (level >= wpi::WPI_LOG_DEBUG3) {
|
|
|
|
|
return EventFlags::kLogMessage | kFlagDebug3;
|
|
|
|
|
} else if (level >= wpi::WPI_LOG_DEBUG4) {
|
|
|
|
|
return EventFlags::kLogMessage | kFlagDebug4;
|
|
|
|
|
} else {
|
|
|
|
|
return EventFlags::kLogMessage;
|
2022-10-08 10:01:31 -07:00
|
|
|
}
|
2020-12-28 12:58:06 -08:00
|
|
|
}
|
Implement independent instances.
Previously, most of the classes were implemented as singletons so only one
instance was possible.
This change adds an instance handle-based API. In Java, this API is located
in a different package than the old API (edu.wpi.first.networktables).
Backwards compatibility with ITable and the old NetworkTable API is largely
maintained, but a handful of classes have moved to the new package in Java
(ConnectionInfo and PersistentException), and the old JNI has been completed
replaced.
Also:
- Move SetTeam implementation to Dispatcher.
- Consistently pass time through Java and C++ Value API.
- Rename nt_Value.h to NetworkTableValue.h for consistency with Java.
- Improve documentation
- Make C++ and Java APIs more consistent
- Document RPC functions and support RPC in Java.
- Add polling features for entry and connection listeners and use them to
move callback threads to Java level.
- Remove thread start and stop hooks (as polling is available).
- Make Notifiers, RpcServer, Dispatcher, and Storage mockable.
- Set NOTIFY_NEW on immediate entry notifications.
- Make GetTable("/") and GetTable("") equivalent.
- Generate local notification for flags update when loading persistent file.
And many unit test updates/changes:
- Use InitGoogleMock instead of InitGoogleTest in test main.
- Move test printers to TestPrinter.h/cpp.
- Provide printers for StringRef, EntryNotifier, and Handle.
- StorageTest: Check notifications.
- Add entry notifier unit tests.
- Storage: Add test for incoming entry assignment.
- Update connection listener tests.
- Add entry listener unit tests.
Fixes #11, #140, #189, #190, #192, #193, #221
2017-04-23 10:26:17 -07:00
|
|
|
|
2022-10-31 21:52:14 -07:00
|
|
|
static unsigned int LevelsToEventMask(unsigned int minLevel,
|
|
|
|
|
unsigned int maxLevel) {
|
|
|
|
|
unsigned int mask = 0;
|
|
|
|
|
if (minLevel <= wpi::WPI_LOG_CRITICAL && maxLevel >= wpi::WPI_LOG_CRITICAL) {
|
|
|
|
|
mask |= kFlagCritical;
|
2022-10-08 10:01:31 -07:00
|
|
|
}
|
2022-10-31 21:52:14 -07:00
|
|
|
if (minLevel <= wpi::WPI_LOG_ERROR && maxLevel >= wpi::WPI_LOG_ERROR) {
|
|
|
|
|
mask |= kFlagError;
|
2022-10-08 10:01:31 -07:00
|
|
|
}
|
2022-10-31 21:52:14 -07:00
|
|
|
if (minLevel <= wpi::WPI_LOG_WARNING && maxLevel >= wpi::WPI_LOG_WARNING) {
|
|
|
|
|
mask |= kFlagWarning;
|
|
|
|
|
}
|
|
|
|
|
if (minLevel <= wpi::WPI_LOG_INFO && maxLevel >= wpi::WPI_LOG_INFO) {
|
|
|
|
|
mask |= kFlagInfo;
|
|
|
|
|
}
|
|
|
|
|
if (minLevel <= wpi::WPI_LOG_DEBUG && maxLevel >= wpi::WPI_LOG_DEBUG) {
|
|
|
|
|
mask |= kFlagDebug;
|
|
|
|
|
}
|
|
|
|
|
if (minLevel <= wpi::WPI_LOG_DEBUG1 && maxLevel >= wpi::WPI_LOG_DEBUG1) {
|
|
|
|
|
mask |= kFlagDebug1;
|
|
|
|
|
}
|
|
|
|
|
if (minLevel <= wpi::WPI_LOG_DEBUG2 && maxLevel >= wpi::WPI_LOG_DEBUG2) {
|
|
|
|
|
mask |= kFlagDebug2;
|
|
|
|
|
}
|
|
|
|
|
if (minLevel <= wpi::WPI_LOG_DEBUG3 && maxLevel >= wpi::WPI_LOG_DEBUG3) {
|
|
|
|
|
mask |= kFlagDebug3;
|
|
|
|
|
}
|
|
|
|
|
if (minLevel <= wpi::WPI_LOG_DEBUG4 && maxLevel >= wpi::WPI_LOG_DEBUG4) {
|
|
|
|
|
mask |= kFlagDebug4;
|
|
|
|
|
}
|
|
|
|
|
if (mask == 0) {
|
|
|
|
|
mask = EventFlags::kLogMessage;
|
|
|
|
|
}
|
|
|
|
|
return mask;
|
Implement independent instances.
Previously, most of the classes were implemented as singletons so only one
instance was possible.
This change adds an instance handle-based API. In Java, this API is located
in a different package than the old API (edu.wpi.first.networktables).
Backwards compatibility with ITable and the old NetworkTable API is largely
maintained, but a handful of classes have moved to the new package in Java
(ConnectionInfo and PersistentException), and the old JNI has been completed
replaced.
Also:
- Move SetTeam implementation to Dispatcher.
- Consistently pass time through Java and C++ Value API.
- Rename nt_Value.h to NetworkTableValue.h for consistency with Java.
- Improve documentation
- Make C++ and Java APIs more consistent
- Document RPC functions and support RPC in Java.
- Add polling features for entry and connection listeners and use them to
move callback threads to Java level.
- Remove thread start and stop hooks (as polling is available).
- Make Notifiers, RpcServer, Dispatcher, and Storage mockable.
- Set NOTIFY_NEW on immediate entry notifications.
- Make GetTable("/") and GetTable("") equivalent.
- Generate local notification for flags update when loading persistent file.
And many unit test updates/changes:
- Use InitGoogleMock instead of InitGoogleTest in test main.
- Move test printers to TestPrinter.h/cpp.
- Provide printers for StringRef, EntryNotifier, and Handle.
- StorageTest: Check notifications.
- Add entry notifier unit tests.
- Storage: Add test for incoming entry assignment.
- Update connection listener tests.
- Add entry listener unit tests.
Fixes #11, #140, #189, #190, #192, #193, #221
2017-04-23 10:26:17 -07:00
|
|
|
}
|
|
|
|
|
|
2022-10-31 21:52:14 -07:00
|
|
|
LoggerImpl::LoggerImpl(IListenerStorage& listenerStorage)
|
|
|
|
|
: m_listenerStorage{listenerStorage} {}
|
2022-10-08 10:01:31 -07:00
|
|
|
|
2022-10-31 21:52:14 -07:00
|
|
|
LoggerImpl::~LoggerImpl() = default;
|
2022-10-08 10:01:31 -07:00
|
|
|
|
2022-10-31 21:52:14 -07:00
|
|
|
void LoggerImpl::AddListener(NT_Listener listener, unsigned int minLevel,
|
|
|
|
|
unsigned int maxLevel) {
|
|
|
|
|
++m_listenerCount;
|
2022-10-08 10:01:31 -07:00
|
|
|
std::scoped_lock lock{m_mutex};
|
2022-10-31 21:52:14 -07:00
|
|
|
m_listenerLevels.emplace_back(listener, minLevel, maxLevel);
|
|
|
|
|
m_listenerStorage.Activate(listener, LevelsToEventMask(minLevel, maxLevel),
|
|
|
|
|
[](unsigned int mask, Event* event) {
|
|
|
|
|
event->flags = NT_EVENT_LOGMESSAGE;
|
|
|
|
|
return true;
|
|
|
|
|
});
|
2022-10-08 10:01:31 -07:00
|
|
|
}
|
|
|
|
|
|
2022-10-31 21:52:14 -07:00
|
|
|
void LoggerImpl::RemoveListener(NT_Listener listener) {
|
|
|
|
|
--m_listenerCount;
|
2022-10-08 10:01:31 -07:00
|
|
|
std::scoped_lock lock{m_mutex};
|
2022-10-31 21:52:14 -07:00
|
|
|
std::erase_if(m_listenerLevels,
|
|
|
|
|
[&](auto& v) { return v.listener == listener; });
|
2022-10-08 10:01:31 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
unsigned int LoggerImpl::GetMinLevel() {
|
|
|
|
|
// return 0;
|
2022-10-31 21:52:14 -07:00
|
|
|
std::scoped_lock lock{m_mutex};
|
Implement independent instances.
Previously, most of the classes were implemented as singletons so only one
instance was possible.
This change adds an instance handle-based API. In Java, this API is located
in a different package than the old API (edu.wpi.first.networktables).
Backwards compatibility with ITable and the old NetworkTable API is largely
maintained, but a handful of classes have moved to the new package in Java
(ConnectionInfo and PersistentException), and the old JNI has been completed
replaced.
Also:
- Move SetTeam implementation to Dispatcher.
- Consistently pass time through Java and C++ Value API.
- Rename nt_Value.h to NetworkTableValue.h for consistency with Java.
- Improve documentation
- Make C++ and Java APIs more consistent
- Document RPC functions and support RPC in Java.
- Add polling features for entry and connection listeners and use them to
move callback threads to Java level.
- Remove thread start and stop hooks (as polling is available).
- Make Notifiers, RpcServer, Dispatcher, and Storage mockable.
- Set NOTIFY_NEW on immediate entry notifications.
- Make GetTable("/") and GetTable("") equivalent.
- Generate local notification for flags update when loading persistent file.
And many unit test updates/changes:
- Use InitGoogleMock instead of InitGoogleTest in test main.
- Move test printers to TestPrinter.h/cpp.
- Provide printers for StringRef, EntryNotifier, and Handle.
- StorageTest: Check notifications.
- Add entry notifier unit tests.
- Storage: Add test for incoming entry assignment.
- Update connection listener tests.
- Add entry listener unit tests.
Fixes #11, #140, #189, #190, #192, #193, #221
2017-04-23 10:26:17 -07:00
|
|
|
unsigned int level = NT_LOG_INFO;
|
2022-10-31 21:52:14 -07:00
|
|
|
for (auto&& listenerLevel : m_listenerLevels) {
|
|
|
|
|
if (listenerLevel.minLevel < level) {
|
|
|
|
|
level = listenerLevel.minLevel;
|
2020-12-28 12:58:06 -08:00
|
|
|
}
|
Implement independent instances.
Previously, most of the classes were implemented as singletons so only one
instance was possible.
This change adds an instance handle-based API. In Java, this API is located
in a different package than the old API (edu.wpi.first.networktables).
Backwards compatibility with ITable and the old NetworkTable API is largely
maintained, but a handful of classes have moved to the new package in Java
(ConnectionInfo and PersistentException), and the old JNI has been completed
replaced.
Also:
- Move SetTeam implementation to Dispatcher.
- Consistently pass time through Java and C++ Value API.
- Rename nt_Value.h to NetworkTableValue.h for consistency with Java.
- Improve documentation
- Make C++ and Java APIs more consistent
- Document RPC functions and support RPC in Java.
- Add polling features for entry and connection listeners and use them to
move callback threads to Java level.
- Remove thread start and stop hooks (as polling is available).
- Make Notifiers, RpcServer, Dispatcher, and Storage mockable.
- Set NOTIFY_NEW on immediate entry notifications.
- Make GetTable("/") and GetTable("") equivalent.
- Generate local notification for flags update when loading persistent file.
And many unit test updates/changes:
- Use InitGoogleMock instead of InitGoogleTest in test main.
- Move test printers to TestPrinter.h/cpp.
- Provide printers for StringRef, EntryNotifier, and Handle.
- StorageTest: Check notifications.
- Add entry notifier unit tests.
- Storage: Add test for incoming entry assignment.
- Update connection listener tests.
- Add entry listener unit tests.
Fixes #11, #140, #189, #190, #192, #193, #221
2017-04-23 10:26:17 -07:00
|
|
|
}
|
|
|
|
|
return level;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void LoggerImpl::Log(unsigned int level, const char* file, unsigned int line,
|
|
|
|
|
const char* msg) {
|
2021-06-01 21:50:35 -07:00
|
|
|
auto filename = fs::path{file}.filename();
|
2022-10-31 21:52:14 -07:00
|
|
|
if (m_listenerCount == 0) {
|
|
|
|
|
DefaultLogger(level, filename.string().c_str(), line, msg);
|
|
|
|
|
} else {
|
|
|
|
|
m_listenerStorage.Notify(LevelToFlag(level), level, filename.string(), line,
|
|
|
|
|
msg);
|
Implement independent instances.
Previously, most of the classes were implemented as singletons so only one
instance was possible.
This change adds an instance handle-based API. In Java, this API is located
in a different package than the old API (edu.wpi.first.networktables).
Backwards compatibility with ITable and the old NetworkTable API is largely
maintained, but a handful of classes have moved to the new package in Java
(ConnectionInfo and PersistentException), and the old JNI has been completed
replaced.
Also:
- Move SetTeam implementation to Dispatcher.
- Consistently pass time through Java and C++ Value API.
- Rename nt_Value.h to NetworkTableValue.h for consistency with Java.
- Improve documentation
- Make C++ and Java APIs more consistent
- Document RPC functions and support RPC in Java.
- Add polling features for entry and connection listeners and use them to
move callback threads to Java level.
- Remove thread start and stop hooks (as polling is available).
- Make Notifiers, RpcServer, Dispatcher, and Storage mockable.
- Set NOTIFY_NEW on immediate entry notifications.
- Make GetTable("/") and GetTable("") equivalent.
- Generate local notification for flags update when loading persistent file.
And many unit test updates/changes:
- Use InitGoogleMock instead of InitGoogleTest in test main.
- Move test printers to TestPrinter.h/cpp.
- Provide printers for StringRef, EntryNotifier, and Handle.
- StorageTest: Check notifications.
- Add entry notifier unit tests.
- Storage: Add test for incoming entry assignment.
- Update connection listener tests.
- Add entry listener unit tests.
Fixes #11, #140, #189, #190, #192, #193, #221
2017-04-23 10:26:17 -07:00
|
|
|
}
|
|
|
|
|
}
|