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
32 OC_LOG_MIN_VAL__ = -1,
43 typedef struct _oc_log_ctx
47 oc_log_level log_level;
51 /* Required interface: */
52 int (*init) (struct _oc_log_ctx *, void *);
53 void (*destroy) (struct _oc_log_ctx *);
54 void (*flush) (struct _oc_log_ctx *);
55 void (*set_level) (struct _oc_log_ctx *, const int);
56 size_t (*write_level) (struct _oc_log_ctx *, const int, const char *);
57 int (*set_module) (struct _oc_log_ctx *, const char *);
59 /* Optional interface (if one is implemented, all must be implemented): */
60 int (*lock) (struct _oc_log_ctx *);
61 int (*unlock) (struct _oc_log_ctx *);
62 int (*try_lock) (struct _oc_log_ctx *);
63 int (*locked_destroy) (struct _oc_log_ctx *);
67 /* Notice that these are all passed the /top level/ ctx-- it's "public" with respect to
68 these functions, they have full access to fiddle with the structure all they want (but,
69 generally should avoid doing that); I could certainly be convinced to go the other direction,
70 and have most functions only take the inner context: */
71 typedef int (*oc_log_init_t) (oc_log_ctx_t *, void *);
72 typedef void (*oc_log_destroy_t) (oc_log_ctx_t *);
73 typedef void (*oc_log_flush_t) (oc_log_ctx_t *);
74 typedef void (*oc_log_set_level_t) (oc_log_ctx_t *, const int);
75 typedef size_t (*oc_log_write_level_t) (oc_log_ctx_t *, const int, const char *);
76 typedef int (*oc_log_set_module_t) (oc_log_ctx_t *, const char *);
77 typedef int (*oc_log_lock_t) (oc_log_ctx_t *);
78 typedef int (*oc_log_unlock_t) (oc_log_ctx_t *);
79 typedef int (*oc_log_try_lock_t) (oc_log_ctx_t *);