1 //******************************************************************
3 // Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
11 // http://www.apache.org/licenses/LICENSE-2.0
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
21 #ifndef __OC_LOGGER_TYPES_H_2024_09_5
22 #define __OC_LOGGER_TYPES_H_2024_09_5
42 typedef struct _oc_log_ctx
46 oc_log_level log_level;
50 /* Required interface: */
51 int (*init) (struct _oc_log_ctx *, void *);
52 void (*destroy) (struct _oc_log_ctx *);
53 void (*flush) (struct _oc_log_ctx *);
54 void (*set_level) (struct _oc_log_ctx *, const int);
55 size_t (*write_level) (struct _oc_log_ctx *, const int, const char *);
56 int (*set_module) (struct _oc_log_ctx *, const char *);
58 /* Optional interface (if one is implemented, all must be implemented): */
59 int (*lock) (struct _oc_log_ctx *);
60 int (*unlock) (struct _oc_log_ctx *);
61 int (*try_lock) (struct _oc_log_ctx *);
62 int (*locked_destroy) (struct _oc_log_ctx *);
66 /* Notice that these are all passed the /top level/ ctx-- it's "public" with respect to
67 these functions, they have full access to fiddle with the structure all they want (but,
68 generally should avoid doing that); I could certainly be convinced to go the other direction,
69 and have most functions only take the inner context: */
70 typedef int (*oc_log_init_t) (oc_log_ctx_t *, void *);
71 typedef void (*oc_log_destroy_t) (oc_log_ctx_t *);
72 typedef void (*oc_log_flush_t) (oc_log_ctx_t *);
73 typedef void (*oc_log_set_level_t) (oc_log_ctx_t *, const int);
74 typedef size_t (*oc_log_write_level_t) (oc_log_ctx_t *, const int, const char *);
75 typedef int (*oc_log_set_module_t) (oc_log_ctx_t *, const char *);
76 typedef int (*oc_log_lock_t) (oc_log_ctx_t *);
77 typedef int (*oc_log_unlock_t) (oc_log_ctx_t *);
78 typedef int (*oc_log_try_lock_t) (oc_log_ctx_t *);