Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:24
erlang
6801-tftp-Refactor-tftp_logger-docs.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 6801-tftp-Refactor-tftp_logger-docs.patch of Package erlang
From 28aa30c1ea51257bca08639b1677b649929324a4 Mon Sep 17 00:00:00 2001 From: Lukas Larsson <lukas@erlang.org> Date: Wed, 27 Sep 2023 13:48:09 +0200 Subject: [PATCH 1/5] tftp: Refactor tftp_logger docs --- lib/tftp/doc/src/Makefile | 3 +- lib/tftp/doc/src/ref_man.xml | 1 + lib/tftp/doc/src/tftp.xml | 64 +----------------------- lib/tftp/doc/src/tftp_logger.xml | 84 ++++++++++++++++++++++++++++++++ lib/tftp/src/tftp.erl | 4 +- lib/tftp/src/tftp_logger.erl | 9 ++-- 6 files changed, 93 insertions(+), 72 deletions(-) create mode 100644 lib/tftp/doc/src/tftp_logger.xml diff --git a/lib/tftp/doc/src/Makefile b/lib/tftp/doc/src/Makefile index e227b571d6..5b8db2b03d 100644 --- a/lib/tftp/doc/src/Makefile +++ b/lib/tftp/doc/src/Makefile @@ -39,7 +39,8 @@ XML_CHAPTER_FILES = \ notes.xml XML_REF3_FILES = \ - tftp.xml + tftp.xml \ + tftp_logger.xml XML_PART_FILES = \ usersguide.xml diff --git a/lib/tftp/doc/src/ref_man.xml b/lib/tftp/doc/src/ref_man.xml index 41a6cc6d52..cd73556692 100644 --- a/lib/tftp/doc/src/ref_man.xml +++ b/lib/tftp/doc/src/ref_man.xml @@ -33,4 +33,5 @@ <p>The <c>TFTP</c> application.</p> </description> <xi:include href="tftp.xml"/> + <xi:include href="tftp_logger.xml"/> </application> diff --git a/lib/tftp/doc/src/tftp.xml b/lib/tftp/doc/src/tftp.xml index 520ede365f..84869577be 100644 --- a/lib/tftp/doc/src/tftp.xml +++ b/lib/tftp/doc/src/tftp.xml @@ -154,8 +154,7 @@ <p>Callback module for customized logging of errors, warnings, and info messages. The callback module must implement the - <c>tftp_logger</c> behavior, see - <seeerl marker="#tftp_logger">LOGGER FUNCTIONS</seeerl>. + <seeerl marker="tftp_logger"><c>tftp_logger</c></seeerl> behavior. The default module is <c>tftp_logger</c>.</p> </item> @@ -536,65 +535,4 @@ </desc> </func> </funcs> - - - - <funcs> - <fsdescription> - <marker id="tftp_logger"></marker> - <title>LOGGER FUNCTIONS</title> - - <p>A <c>tftp_logger</c> callback module is to be implemented as a - <c>tftp_logger</c> behavior and export the following functions:</p> - - <marker id="error_msg"></marker> - </fsdescription> - <func> - <name since="OTP 18.1">Logger:error_msg(Format, Data) -> ok | exit(Reason)</name> - <fsummary>Logs an error message.</fsummary> - <type> - <v>Format = string()</v> - <v>Data = [term()]</v> - <v>Reason = term()</v> - </type> - <desc> - <p>Logs an error message. - See <c>error_logger:error_msg/2</c> for details.</p> - - <marker id="warning_msg"></marker> - </desc> - </func> - - <func> - <name since="OTP 18.1">Logger:info_msg(Format, Data) -> ok | exit(Reason)</name> - <fsummary>Logs an info message.</fsummary> - <type> - <v>Format = string()</v> - <v>Data = [term()]</v> - <v>Reason = term()</v> - </type> - <desc> - <p>Logs an info message. - See <c>error_logger:info_msg/2</c> for details.</p> - </desc> - </func> - - <func> - <name since="OTP 18.1">Logger:warning_msg(Format, Data) -> ok | exit(Reason)</name> - <fsummary>Logs a warning message.</fsummary> - <type> - <v>Format = string()</v> - <v>Data = [term()]</v> - <v>Reason = term()</v> - </type> - <desc> - <p>Logs a warning message. - See <c>error_logger:warning_msg/2</c> for details.</p> - - <marker id="info_msg"></marker> - </desc> - </func> - </funcs> </erlref> - - diff --git a/lib/tftp/doc/src/tftp_logger.xml b/lib/tftp/doc/src/tftp_logger.xml new file mode 100644 index 0000000000..49549ccb5e --- /dev/null +++ b/lib/tftp/doc/src/tftp_logger.xml @@ -0,0 +1,84 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!DOCTYPE erlref SYSTEM "erlref.dtd"> + +<erlref> + <header> + <copyright> + <year>2023</year><year>2023</year> + <holder>Ericsson AB. All Rights Reserved.</holder> + </copyright> + <legalnotice> + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + </legalnotice> + + <title>tftp_logger</title> + <prepared></prepared> + <docno></docno> + <date></date> + <rev></rev> + </header> + <module since="OTP 18.1">tftp_logger</module> + <modulesummary>Trivial FTP logger.</modulesummary> + <description> + <p>A <c>tftp_logger</c> callback module is to be implemented as a + <c>tftp_logger</c> behavior and export the following functions:</p> + </description> + + <funcs> + <func> + <name since="OTP 18.1">Module:error_msg(Format, Data) -> ok</name> + <fsummary>Logs an error message.</fsummary> + <type> + <v>Format = string()</v> + <v>Data = [term()]</v> + <v>Reason = term()</v> + </type> + <desc> + <p>Logs an error message. + See <seemfa marker="kernel:error_logger#error_msg/2"> + <c>error_logger:error_msg/2</c></seemfa> for details.</p> + </desc> + </func> + + <func> + <name since="OTP 18.1">Module:info_msg(Format, Data) -> ok</name> + <fsummary>Logs an info message.</fsummary> + <type> + <v>Format = string()</v> + <v>Data = [term()]</v> + <v>Reason = term()</v> + </type> + <desc> + <p>Logs an info message. + See <seemfa marker="kernel:error_logger#info_msg/2"> + <c>error_logger:info_msg/2</c></seemfa> for details.</p> + </desc> + </func> + + <func> + <name since="OTP 18.1">Module:warning_msg(Format, Data) -> ok</name> + <fsummary>Logs a warning message.</fsummary> + <type> + <v>Format = string()</v> + <v>Data = [term()]</v> + <v>Reason = term()</v> + </type> + <desc> + <p>Logs a warning message. + See <seemfa marker="kernel:error_logger#warning_msg/2"> + <c>error_logger:warning_msg/2</c></seemfa> for details.</p> + </desc> + </func> + </funcs> +</erlref> diff --git a/lib/tftp/src/tftp.erl b/lib/tftp/src/tftp.erl index a32d0dca9c..1cabaa5df8 100644 --- a/lib/tftp/src/tftp.erl +++ b/lib/tftp/src/tftp.erl @@ -226,6 +226,7 @@ service_info/1 ]). +-include("tftp.hrl"). -type peer() :: {PeerType :: inet | inet6, PeerHost :: inet:ip_address(), @@ -268,9 +269,6 @@ -callback abort(Code :: error_code(), string(), State :: term()) -> 'ok'. --include("tftp.hrl"). - - %%------------------------------------------------------------------- %% read_file(RemoteFilename, LocalFilename, Options) -> %% {ok, LastCallbackState} | {error, Reason} diff --git a/lib/tftp/src/tftp_logger.erl b/lib/tftp/src/tftp_logger.erl index 548ed509dc..af4e3644a0 100644 --- a/lib/tftp/src/tftp_logger.erl +++ b/lib/tftp/src/tftp_logger.erl @@ -31,12 +31,11 @@ info_msg/2 ]). --export([behaviour_info/1]). +-callback warning_msg(Format :: string(), Data :: [term()]) -> ok. +-callback info_msg(Format :: string(), Data :: [term()]) -> ok. +-callback error_msg(Format :: string(), Data :: [term()]) -> ok. -behaviour_info(callbacks) -> - [{error_msg, 2}, {warning_msg, 2}, {info_msg, 2}]; -behaviour_info(_) -> - undefined. +-optional_callbacks([warning_msg/2, error_msg/2, info_msg/2]). %%------------------------------------------------------------------- %% error_msg(Format, Data) -> ok | exit(Reason) -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor