Skip to content

Commit

Permalink
Add accessor for flags of the current query logger
Browse files Browse the repository at this point in the history
They are new API.
  • Loading branch information
kou committed Jun 24, 2017
1 parent b3c50ca commit d7402e5
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
4 changes: 4 additions & 0 deletions include/groonga/groonga.h
Original file line number Diff line number Diff line change
Expand Up @@ -1122,6 +1122,10 @@ struct _grn_query_logger {
};

GRN_API grn_rc grn_query_logger_set(grn_ctx *ctx, const grn_query_logger *logger);
GRN_API void grn_query_logger_set_flags(grn_ctx *ctx, unsigned int flags);
GRN_API void grn_query_logger_add_flags(grn_ctx *ctx, unsigned int flags);
GRN_API void grn_query_logger_remove_flags(grn_ctx *ctx, unsigned int flags);
GRN_API unsigned int grn_query_logger_get_flags(grn_ctx *ctx);

GRN_API void grn_query_logger_put(grn_ctx *ctx, unsigned int flag,
const char *mark,
Expand Down
24 changes: 24 additions & 0 deletions lib/logger.c
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,30 @@ grn_query_logger_set(grn_ctx *ctx, const grn_query_logger *logger)
return GRN_SUCCESS;
}

void
grn_query_logger_set_flags(grn_ctx *ctx, unsigned int flags)
{
current_query_logger.flags = flags;
}

void
grn_query_logger_add_flags(grn_ctx *ctx, unsigned int flags)
{
current_query_logger.flags |= flags;
}

void
grn_query_logger_remove_flags(grn_ctx *ctx, unsigned int flags)
{
current_query_logger.flags &= ~flags;
}

unsigned int
grn_query_logger_get_flags(grn_ctx *ctx)
{
return current_query_logger.flags;
}

grn_bool
grn_query_logger_pass(grn_ctx *ctx, unsigned int flag)
{
Expand Down

0 comments on commit d7402e5

Please sign in to comment.