Skip to content

Commit

Permalink
support log prefix
Browse files Browse the repository at this point in the history
Signed-off-by: ryjiang <[email protected]>
  • Loading branch information
shanghaikid committed Nov 25, 2024
1 parent 1f009df commit 57c2bb6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions milvus/MilvusClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ export class MilvusClient extends GRPCClient {
if (this.config.logLevel) {
logger.level = this.config.logLevel;
}
if (this.config.logPrefix) {
logger.defaultMeta = { service: this.config.logPrefix };
}

logger.debug(
`new client initialized, version: ${MilvusClient.sdkInfo.version} `
Expand Down
2 changes: 2 additions & 0 deletions milvus/types/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ export interface ClientConfig {
database?: string;
// log level
logLevel?: string;
// log prefix
logPrefix?: string;

tls?: {
// root certificate file path, it can be a CA PEM (Certificate Authority PEM) or Server PEM (Server Certificate PEM):
Expand Down
6 changes: 5 additions & 1 deletion test/grpc/Basic.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { MilvusClient, ErrorCode, DataType } from '../../milvus';
import { IP, GENERATE_NAME, generateInsertData } from '../tools';

const milvusClient = new MilvusClient({ address: IP, logLevel: 'info' });
const milvusClient = new MilvusClient({
address: IP,
logLevel: 'debug',
logPrefix: 'Basic API',
});
const COLLECTION_NAME = GENERATE_NAME();
const schema = [
{
Expand Down

0 comments on commit 57c2bb6

Please sign in to comment.