struct log_target *log_target_create_vty(struct vty *vty) { struct log_target *target; target = log_target_create(); if (!target) return NULL; target->tgt_vty.vty = vty; target->output = _vty_output; return target; }
/*! \brief Create a new logging target for syslog logging * \param[in] ident syslog string identifier * \param[in] option syslog options * \param[in] facility syslog facility * \returns Log target in case of success, NULL in case of error */ struct log_target *log_target_create_syslog(const char *ident, int option, int facility) { struct log_target *target; target = log_target_create(); if (!target) return NULL; target->tgt_syslog.facility = facility; target->type = LOG_TGT_TYPE_SYSLOG; target->output = _syslog_output; openlog(ident, option, facility); return target; }
/*! \brief Create a new logging target for ringbuffer-backed logging. * \param[in] size The capacity (number of messages) of the logging target. * \returns A log target in case of success, NULL in case of error. */ struct log_target *log_target_create_rb(size_t size) { struct log_target *target; struct osmo_strrb *rb; target = log_target_create(); if (!target) return NULL; rb = osmo_strrb_create(target, size + 1); if (!rb) { log_target_destroy(target); return NULL; } target->tgt_rb.rb = rb; target->type = LOG_TGT_TYPE_STRRB; target->output = _rb_output; return target; }