Move ASN1C enc/dec logging to its own category
ASN1C encoding/decoding can get really verbose. Furthermore, it should only be enabled under really specific conditions, so it makes sense to have it under its own category. Change-Id: Ia4cbae2395532d9b5b7b9177a7d0f31bf777d751
This commit is contained in:
parent
bc21b3ae81
commit
1429377005
|
@ -1,8 +1,9 @@
|
|||
log stderr
|
||||
logging level main notice
|
||||
logging level rest notice
|
||||
logging level cbsp notice
|
||||
logging level sbcap notice
|
||||
logging level asn1c notice
|
||||
logging level rest notice
|
||||
cbc
|
||||
unknown-peers reject
|
||||
ecbe
|
||||
|
|
|
@ -4,5 +4,6 @@ enum {
|
|||
DMAIN,
|
||||
DCBSP,
|
||||
DSBcAP,
|
||||
DASN1C,
|
||||
DREST,
|
||||
};
|
||||
|
|
|
@ -118,8 +118,8 @@
|
|||
|
||||
#include <osmocom/core/logging.h>
|
||||
|
||||
extern int _sbcap_DSBCAP;
|
||||
#define SBC_AP_DEBUG(x, args ...) DEBUGP(_sbcap_DSBCAP, x, ## args)
|
||||
extern int _sbcap_DASN1C;
|
||||
#define SBC_AP_DEBUG(x, args ...) DEBUGP(_sbcap_DASN1C, x, ## args)
|
||||
|
||||
extern int asn1_xer_print;
|
||||
|
||||
|
@ -140,7 +140,7 @@ SBcAP_SBC_AP_PDU_t *sbcap_decode(const struct msgb *msg);
|
|||
const char *sbcap_procedure_code_str(SBcAP_ProcedureCode_t pc);
|
||||
const char *sbcap_cause_str(SBcAP_Cause_t cause);
|
||||
|
||||
void sbcap_set_log_area(int log_area);
|
||||
void sbcap_set_log_area(int log_area_sbcap, int log_area_asn1c);
|
||||
|
||||
SBcAP_ProcedureCode_t sbcap_pdu_get_procedure_code(const SBcAP_SBC_AP_PDU_t *pdu);
|
||||
SBcAP_Criticality_t sbcap_pdu_get_criticality(const SBcAP_SBC_AP_PDU_t *pdu);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#include <osmocom/core/logging.h>
|
||||
|
||||
extern int _sbcap_DSBCAP;
|
||||
#define SBC_AP_ASN_DEBUG(x, args ...) DEBUGP(_sbcap_DSBCAP, x "\n", ## args)
|
||||
extern int _sbcap_DASN1C;
|
||||
#define SBC_AP_ASN_DEBUG(x, args ...) DEBUGP(_sbcap_DASN1C, x "\n", ## args)
|
||||
|
||||
#define ASN_DEBUG SBC_AP_ASN_DEBUG
|
||||
|
|
|
@ -44,6 +44,8 @@
|
|||
#include <osmocom/vty/logging.h>
|
||||
#include <osmocom/vty/misc.h>
|
||||
|
||||
#include <osmocom/sbcap/sbcap_common.h>
|
||||
|
||||
#include <osmocom/cbc/debug.h>
|
||||
#include <osmocom/cbc/cbc_data.h>
|
||||
#include <osmocom/cbc/cbc_vty.h>
|
||||
|
@ -74,6 +76,13 @@ static const struct log_info_cat log_info_cat[] = {
|
|||
.enabled = 1,
|
||||
.loglevel = LOGL_NOTICE,
|
||||
},
|
||||
[DASN1C] = {
|
||||
.name = "DASN1C",
|
||||
.description = "SBc-AP ASN1C enc/dec",
|
||||
.color = "\033[1;34m",
|
||||
.enabled = 1,
|
||||
.loglevel = LOGL_NOTICE,
|
||||
},
|
||||
[DREST] = {
|
||||
.name = "DREST",
|
||||
.description = "REST interface",
|
||||
|
@ -250,6 +259,7 @@ int main(int argc, char **argv)
|
|||
msgb_talloc_ctx_init(tall_cbc_ctx, 0);
|
||||
osmo_init_logging2(tall_cbc_ctx, &log_info);
|
||||
log_enable_multithread();
|
||||
sbcap_set_log_area(DSBcAP, DASN1C);
|
||||
osmo_stats_init(tall_cbc_ctx);
|
||||
vty_init(&vty_info);
|
||||
|
||||
|
|
|
@ -28,7 +28,9 @@
|
|||
extern int asn1_xer_print;
|
||||
|
||||
int _sbcap_DSBCAP = 0;
|
||||
int _sbcap_DASN1C = 0;
|
||||
#define DSBCAP _sbcap_DSBCAP
|
||||
#define DASN1C _sbcap_DASN1C
|
||||
|
||||
static const struct value_string sbcap_procedure_code_vals[] = {
|
||||
{ SBcAP_ProcedureId_Write_Replace_Warning, "Write-Replace-Warning" },
|
||||
|
@ -91,7 +93,8 @@ struct msgb *sbcap_encode(SBcAP_SBC_AP_PDU_t *pdu)
|
|||
rval = aper_encode_to_buffer(&asn_DEF_SBcAP_SBC_AP_PDU, NULL, pdu,
|
||||
msgb_data(msg), msgb_tailroom(msg));
|
||||
if (rval.encoded < 0) {
|
||||
LOGP(DSBCAP, LOGL_ERROR, "Error encoding type: %s\n",
|
||||
LOGP(DSBCAP, LOGL_ERROR, "%s: Error encoding type: %s\n",
|
||||
sbcap_pdu_get_name(pdu),
|
||||
rval.failed_type->name);
|
||||
msgb_free(msg);
|
||||
return NULL;
|
||||
|
@ -112,6 +115,7 @@ SBcAP_SBC_AP_PDU_t *sbcap_decode(const struct msgb *msg)
|
|||
LOGP(DSBCAP, LOGL_ERROR, "Error decoding code=%d\n", rval.code);
|
||||
return NULL;
|
||||
}
|
||||
LOGP(DSBCAP, LOGL_DEBUG, "Decoded %s\n", sbcap_pdu_get_name(pdu));
|
||||
return pdu;
|
||||
}
|
||||
|
||||
|
@ -192,9 +196,10 @@ void *sbcap_as_find_ie(void *void_list, SBcAP_ProtocolIE_ID_t ie_id)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void sbcap_set_log_area(int log_area)
|
||||
void sbcap_set_log_area(int log_area_sbcap, int log_area_asn1c)
|
||||
{
|
||||
_sbcap_DSBCAP = log_area;
|
||||
_sbcap_DSBCAP = log_area_sbcap;
|
||||
_sbcap_DASN1C = log_area_asn1c;
|
||||
}
|
||||
|
||||
SBcAP_Write_Replace_Warning_Request_IEs_t *sbcap_alloc_Write_Replace_Warning_Request_IE(
|
||||
|
|
|
@ -202,8 +202,8 @@ SBc Application Part
|
|||
|
||||
static const struct log_info_cat log_categories[] = {
|
||||
[0] = {
|
||||
.name = "DSBcAP",
|
||||
.description = "SBc Application Part (CBC-MME)",
|
||||
.name = "DMAIN",
|
||||
.description = "main category",
|
||||
.color = "\033[1;32m",
|
||||
.enabled = 1,
|
||||
.loglevel = LOGL_DEBUG,
|
||||
|
@ -220,7 +220,7 @@ int main(int argc, char **argv)
|
|||
void *ctx = talloc_named_const(NULL, 0, "mgcp_test");
|
||||
void *msgb_ctx = msgb_talloc_ctx_init(ctx, 0);
|
||||
osmo_init_logging2(ctx, &log_info);
|
||||
sbcap_set_log_area(0);
|
||||
sbcap_set_log_area(0, 0);
|
||||
log_set_log_level(osmo_stderr_target, LOGL_DEBUG);
|
||||
log_set_print_category_hex(osmo_stderr_target, 0);
|
||||
log_set_print_category(osmo_stderr_target, 0);
|
||||
|
|
Loading…
Reference in New Issue