-
Notifications
You must be signed in to change notification settings - Fork 0
feat(BC-309): Upgrade Couchbase Lite C from 3.2.1 to 3.2.2 #29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
Cargo.lock | ||
|
||
.vscode | ||
.idea | ||
|
||
# MacOS directory conf | ||
.DS_Store |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// | ||
// LogSinks.hh | ||
// | ||
// Copyright (c) 2025 Couchbase, Inc All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
// VOLATILE API: Couchbase Lite C++ API is not finalized, and may change in | ||
// future releases. | ||
|
||
#pragma once | ||
#include "cbl/CBLLogSinks.h" | ||
|
||
CBL_ASSUME_NONNULL_BEGIN | ||
|
||
namespace cbl { | ||
class LogSinks { | ||
public: | ||
static void setConsole(const CBLConsoleLogSink& sink) { | ||
CBLLogSinks_SetConsole(sink); | ||
} | ||
|
||
static CBLConsoleLogSink console() { | ||
return CBLLogSinks_Console(); | ||
} | ||
|
||
static void setCustom(const CBLCustomLogSink& sink) { | ||
CBLLogSinks_SetCustom(sink); | ||
} | ||
|
||
static CBLCustomLogSink custom() { | ||
return CBLLogSinks_CustomSink(); | ||
} | ||
|
||
static void setFile(const CBLFileLogSink& sink) { | ||
CBLLogSinks_SetFile(sink); | ||
} | ||
|
||
static CBLFileLogSink file() { | ||
return CBLLogSinks_File(); | ||
} | ||
}; | ||
} | ||
|
||
CBL_ASSUME_NONNULL_END |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
// | ||
// CBLLogSink.h | ||
// | ||
// Copyright © 2024 Couchbase. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
#pragma once | ||
#include "CBLBase.h" | ||
|
||
CBL_CAPI_BEGIN | ||
|
||
/** \defgroup logging Logging (Deprecated) | ||
@{ | ||
Manages Couchbase Lite logging configuration, with three log sinks: | ||
- **Console Log Sink**: Enabled by default at the **warning** level for all domains. | ||
- **Custom Log Sink**: Logs to a user-defined callback. | ||
- **File Log Sink**: Logs to files with customizable settings. | ||
*/ | ||
|
||
/** The severity level of log messages */ | ||
typedef CBL_ENUM(uint8_t, CBLLogLevel) { | ||
kCBLLogDebug, ///< Debug-level messages with highly detailed information, Available only in debug builds of Couchbase Lite. | ||
kCBLLogVerbose, ///< Verbose messages providing detailed operational information. | ||
kCBLLogInfo, ///< Info messages about normal application behavior. | ||
kCBLLogWarning, ///< Warning messages indicating potential issues or unusual conditions. | ||
kCBLLogError, ///< Error messages indicating a failure or problem that occurred. | ||
kCBLLogNone ///< Disables logging entirely. No messages will be logged. | ||
}; | ||
|
||
/** Subsystems for logging messages. */ | ||
typedef CBL_ENUM(uint8_t, CBLLogDomain) { | ||
kCBLLogDomainDatabase, ///< Logging domain for the database subsystem. | ||
kCBLLogDomainQuery, ///< Logging domain for the query subsystem. | ||
kCBLLogDomainReplicator, ///< Logging domain for the replicator subsystem. | ||
kCBLLogDomainNetwork ///< Logging domain for the network subsystem. | ||
}; | ||
|
||
/** A bitmask representing a set of logging domains. | ||
* | ||
* Use this bitmask to specify one or more logging domains by combining the | ||
* constants with the bitwise OR operator (`|`). This is helpful for enabling | ||
* or filtering logs for specific domains. */ | ||
typedef CBL_OPTIONS(uint16_t, CBLLogDomainMask) { | ||
kCBLLogDomainMaskDatabase = 1 << kCBLLogDomainDatabase, | ||
kCBLLogDomainMaskQuery = 1 << kCBLLogDomainQuery, | ||
kCBLLogDomainMaskReplicator = 1 << kCBLLogDomainReplicator, | ||
kCBLLogDomainMaskNetwork = 1 << kCBLLogDomainNetwork, | ||
kCBLLogDomainMaskAll = 0xFF | ||
}; | ||
|
||
/** A callback function for a custom log sink. | ||
@param domain The domain of the message | ||
@param level The severity level of the message. | ||
@param message The actual formatted message. */ | ||
typedef void (*CBLLogSinkCallback)(CBLLogDomain domain, CBLLogLevel level, FLString message); | ||
|
||
/** Console log sink configuration for logging to the cosole. */ | ||
typedef struct { | ||
CBLLogLevel level; ///< The minimum level of message to write (Required). | ||
CBLLogDomainMask domains; ///< Bitmask for enabled log domains. Use zero for all domains. | ||
} CBLConsoleLogSink; | ||
|
||
/** Custom log sink configuration for logging to a user-defined callback. */ | ||
typedef struct { | ||
CBLLogLevel level; ///< The minimum level of message to write (Required). | ||
CBLLogSinkCallback _cbl_nullable callback; ///< Custom log callback (Required). | ||
CBLLogDomainMask domains; ///< Bitmask for enabled log domains. Use zero for all domains. | ||
} CBLCustomLogSink; | ||
|
||
/** File log sink configuration for logging to files. */ | ||
typedef struct { | ||
CBLLogLevel level; ///< The minimum level of message to write (Required). | ||
FLString directory; ///< The directory where log files will be created (Required). | ||
|
||
/** The maximum number of files to save per log level. | ||
The default is \ref kCBLDefaultFileLogSinkMaxKeptFiles. */ | ||
uint32_t maxKeptFiles; | ||
|
||
/** The size in bytes at which a file will be rotated out (best effort). | ||
The default is \ref kCBLDefaultFileLogSinkMaxSize. */ | ||
size_t maxSize; | ||
|
||
/** Whether or not to log in plaintext as opposed to binary. Plaintext logging is slower and bigger. | ||
The default is \ref kCBLDefaultFileLogSinkUsePlaintext. */ | ||
bool usePlaintext; | ||
} CBLFileLogSink; | ||
|
||
/** Set the console log sink. To disable the console log sink, set the log level to kCBLLogNone. */ | ||
void CBLLogSinks_SetConsole(CBLConsoleLogSink sink) CBLAPI; | ||
|
||
/** Get the current console log sink. The console log sink is enabled at the warning level for all domains by default. */ | ||
CBLConsoleLogSink CBLLogSinks_Console(void) CBLAPI; | ||
|
||
/** Set the custom log sink. To disable the custom log sink, set the log level to kCBLLogNone. */ | ||
void CBLLogSinks_SetCustom(CBLCustomLogSink sink) CBLAPI; | ||
|
||
/** Get the current custom log sink. The custom log sink is disabled by default. */ | ||
CBLCustomLogSink CBLLogSinks_CustomSink(void) CBLAPI; | ||
|
||
/** Set the file log sink. To disable the file log sink, set the log level to kCBLLogNone. */ | ||
void CBLLogSinks_SetFile(CBLFileLogSink sink) CBLAPI; | ||
|
||
/** Get the current custom log sink. The file log sink is disabled by default. */ | ||
CBLFileLogSink CBLLogSinks_File(void) CBLAPI; | ||
|
||
CBL_CAPI_END | ||
|
||
/** @} */ |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.