Hi,

Thank you for answer.

On my local, the following code works fine:
```
def warning(app, doctree, docname):
    import sphinx
    logger = sphinx.util.logging.getLogger(__name__)
    logger.warning('MyErrorMessage: %s', docname)

def setup(app):
    app.connect("doctree-resolved", warning)
```

Could you check this on your environment?

2019年1月25日(金) 2:29 Maxime Adam <[email protected]>:
>
> Thanks a lot for your answers
>
> Sorry I should have mentioned, when I do run sphinx-build here is my command
> sphinx-build -b html -w ".\sphinx-build.txt" "." ".\html"
>
> Yes the code for WarningDeprecatedUsed is the same as Warning (a mistake from 
> me in my code refactoring while posting it here, sorry)
>
> I also tried Sphinx.errors.SphinxWarning but without success.
>
> Thanks a lot anyway for keeping answering me, it's really appreciated!
> Cheers,
> Maxime.
>
>
> Le jeudi 24 janvier 2019 16:24:24 UTC+1, Komiya Takeshi a écrit :
>>
>> Hi Maxime,
>>
>> What is `sphinx-build.txt`? How did you create it?
>>
>> And the code you pasted does not contain "WarningDeprecatedUsed". Is
>> it same as "Warning"?
>>
>> Thanks,
>> Takeshi KOMIYA
>>
>> 2019年1月24日(木) 3:55 Maxime Adam <[email protected]>:
>> >
>> > Hi I would like to log/raise an error so they are written in red in the 
>> > console and correctly logged into sphinx-build.txt where all others errors 
>> > are logged.
>> >
>> > I've tried to do so, but it's not working. Any hints.
>> >
>> > def Warning(app, doctree, docname):
>> >
>> >     print '\nadfsfddsf\n' # Correctly printed but not written in the log 
>> > file
>> >
>> >     logger = sphinx.util.logging.getLogger(__name__)
>> >     logger.warning('MyErrorMessage', docname)
>> >
>> >
>> > def setup(app):
>> >
>> >     app.connect("doctree-resolved", WarningDeprecatedUsed)
>> >
>> > Any hints are welcome.
>> >
>> > Thanks in advance,
>> >
>> >
>> > Regards
>> >
>> > Maxime! :)
>> >
>> > --
>> > You received this message because you are subscribed to the Google Groups 
>> > "sphinx-users" group.
>> > To unsubscribe from this group and stop receiving emails from it, send an 
>> > email to [email protected].
>> > To post to this group, send email to [email protected].
>> > Visit this group at https://groups.google.com/group/sphinx-users.
>> > For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "sphinx-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/sphinx-users.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sphinx-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to